about summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorClint Adams <clint@users.sourceforge.net>2008-08-24 19:48:09 +0000
committerClint Adams <clint@users.sourceforge.net>2008-08-24 19:48:09 +0000
commit9d7298bac8c9c8930fa69e4bffa75fb6d0beb506 (patch)
treebd2da92215628f7034c482a11bcd7c76dccbdbec /Completion/Unix/Command
parent9fe735e663507164a61341c998247328fa2a738b (diff)
downloadzsh-9d7298bac8c9c8930fa69e4bffa75fb6d0beb506.tar.gz
zsh-9d7298bac8c9c8930fa69e4bffa75fb6d0beb506.tar.xz
zsh-9d7298bac8c9c8930fa69e4bffa75fb6d0beb506.zip
25521: get merge strategies from git merge in case the administrator has added custom strategies.
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/_git10
1 files changed, 6 insertions, 4 deletions
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index a6e75c64a..25bc968b5 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -4039,12 +4039,14 @@ __git_gpg_secret_keys () {
 
 (( $+functions[__git_merge_strategies] )) ||
 __git_merge_strategies () {
-  declare -a merge_strategies_cache
+  local expl
+  local -a merge_strategies
 
-  merge_strategies_cache=(${${=${${(M)${(f)"$(<$(git --exec-path)/git-merge)"}:#all_strategies*}##all_strategies=\'}%%\'}:#recur})
+  if ! merge_strategies=(${=${${(M)${(f)"$(_call_program strategies git merge -s '' 2>&1)"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}); then
+    merge_strategies=(${=${${(M)${(f)"$(<$(git --exec-path)/git-merge)"}:#all_strategies*}##all_strategies=\'}%%\'})
+  fi
 
-  local expl
-  _wanted merge-strategies expl 'merge strategy' compadd - $merge_strategies_cache
+  _wanted merge-strategies expl 'merge strategy' compadd -a merge_strategies "$@"
 }
 
 # TODO: Use this in more places.