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/22 Clint Adams <clint@xxxxxxx>:
> On Thu, Aug 21, 2008 at 10:19:18PM +0200, Mikael Magnusson wrote:
>> 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.
>
> Doesn't do anything with my version.
>
>> So it should be
>> merge_strategies_cache=(${(s: :)${${${${(f)"$(git merge -s ''
>> 2>&1)"}[(r)[Aa]vailable strategies are: *,(r)]}%%.}##*: }})
>
> Gives me a blank array.
>
> Maybe this:
>
> ${(s: :)${${(M)${(f)"$(git merge -s '' 2>&1)"}:#[Aa]vailable strategies are: *}#[Aa]vailable strategies are: }%.}

That doesn't grab the custom strategies line... How about this? Sort
of a hack though... :)

${(s: :)${${${${(f)"$(echo; git merge -s '' 2>&1)"}[(r)[Aa]vailable
strategies are: *,(r)]}%%.}##*: }}

::Some minutes later::
Aha, my first version didn't work for you because it's only one line, so the
(f) doesn't give you an array:
% echo ${${(f)"$(echo available strategies are: recur recursive
octopus resolve stupid ours subtree)"}[(r)[Aa]vailable strategies are:
*]}
a

I've no idea if you can force an array in a better way than with the echo
though.

-- 
Mikael Magnusson



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