summary refs log tree commit diff
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
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.