Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: _git: Update __git_merge_strategies to work with new git.



2008/8/21 Clint Adams <clint@xxxxxxx>:
> On Thu, Aug 21, 2008 at 01:43:15PM +0200, Mikael Magnusson wrote:
>> -  merge_strategies_cache=(${${=${${(M)${(f)"$(<$(git
>> --exec-path)/git-merge)"}:#all_strategies*}##all_strategies=\'}%%\'}:#recur})
>> +  merge_strategies_cache=(${(s: :)${${${${(ps:\n:)"$(git merge -s ''
>> 2>&1)"}[(r)Available strategies are: *,(r)]}%%.}##*: }})
>
> With 1.5.6.3 I get no capital A:

Ah, I knew i forgot something. It changed a bit in 1.6.0. The a -> A and
the trailing dot after the strategies.

> % git merge -s ''
> available strategies are: recur recursive octopus resolve stupid ours subtree
>
> Also (ps:\n:) can be written as (f), but is the output ever more than
> one line?

Yes, touch /usr/local/bin/git-merge-clint and +x it:
% git merge -s ''
Could not find merge strategy ''.
Available strategies are: file octopus ours recursive resolve subtree.
Available custom strategies are: mikachu.
%

It is also "future-proofed" against something like this, same as the sed
script:
% git merge -s ''
Could not find merge strategy ''.
Available strategies are: file octopus ours recursive resolve subtree.
Available custom strategies are: mikachu.

Make sure you spell strategy names correctly.
%

> See if
>
> merge_strategies_cache=(${=${${"$(git merge -s '' 2>&1)"}#[Aa]vailable strategies are: }})
>
> does the right thing for you.

So it should be
merge_strategies_cache=(${(s: :)${${${${(f)"$(git merge -s ''
2>&1)"}[(r)[Aa]vailable strategies are: *,(r)]}%%.}##*: }})

-- 
Mikael Magnusson



Messages sorted by: Reverse Date, Date, Thread, Author