summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_git10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 6da23d08e..475539651 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-08-24  Clint Adams  <clint@zsh.org>
+
+	* 25521: Completion/Unix/Command/_git: get merge strategies from
+	git merge in case the administrator has added custom strategies.
+
 2008-08-22  Peter Stephenson  <pws@csr.com>
 
 	* 25508: Src/exec.c: set file name if function came from
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.