d05544562532fdf4d5f4a4d4eba01f4263e17cc7

Author
Felipe Contreras <felipe.contreras@gmail.com>
Committer
GitHub <noreply@github.com>
Date

Message

gitfast: fetch latest fixes from git-completion (#9390)

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>

Diff

  1diff --git a/plugins/gitfast/_git b/plugins/gitfast/_git
  2index 6ca63ed87b1078654adcc4fbd890ef0a98c1f05f..aaea581d522a0527b32cb48a7c5b2cdbdb2548bb 100644
  3--- a/plugins/gitfast/_git
  4+++ b/plugins/gitfast/_git
  5@@ -27,19 +27,26 @@ zstyle -T ':completion:*:*:git:*' tag-order && \
  6 zstyle -s ":completion:*:*:git:*" script script
  7 if [ -z "$script" ]; then
  8 	local -a locations
  9-	local e
 10+	local e bash_completion
 11+
 12+	bash_completion=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null) ||
 13+		bash_completion='/usr/share/bash-completion/completions/'
 14+
 15 	locations=(
 16 		"$(dirname ${funcsourcetrace[1]%:*})"/git-completion.bash
 17 		"$HOME/.local/share/bash-completion/completions/git"
 18-		"$(pkg-config --variable=completionsdir bash-completion)"/git
 19-		'/usr/share/bash-completion/completions/git'
 20+		"$bash_completion/git"
 21 		'/etc/bash_completion.d/git' # old debian
 22 		)
 23 	for e in $locations; do
 24 		test -f $e && script="$e" && break
 25 	done
 26 fi
 27+
 28+local old_complete="$functions[complete]"
 29+functions[complete]=:
 30 GIT_SOURCING_ZSH_COMPLETION=y . "$script"
 31+functions[complete]="$old_complete"
 32 
 33 __gitcomp ()
 34 {
 35@@ -105,26 +112,26 @@ __gitcomp_nl ()
 36 	compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
 37 }
 38 
 39-__gitcomp_nl_append ()
 40+__gitcomp_file ()
 41 {
 42 	emulate -L zsh
 43 
 44-	compset -P '*[=:]'
 45-	compadd -Q -S "${4- }" -p "${2-}" -- ${(f)1} && _ret=0
 46+	compadd -f -p "${2-}" -- ${(f)1} && _ret=0
 47 }
 48 
 49-__gitcomp_file_direct ()
 50+__gitcomp_direct_append ()
 51 {
 52-	emulate -L zsh
 53-
 54-	compadd -f -- ${(f)1} && _ret=0
 55+	__gitcomp_direct "$@"
 56 }
 57 
 58-__gitcomp_file ()
 59+__gitcomp_nl_append ()
 60 {
 61-	emulate -L zsh
 62+	__gitcomp_nl "$@"
 63+}
 64 
 65-	compadd -f -p "${2-}" -- ${(f)1} && _ret=0
 66+__gitcomp_file_direct ()
 67+{
 68+	__gitcomp_file "$1" ""
 69 }
 70 
 71 _git_zsh ()
 72diff --git a/plugins/gitfast/git-completion.bash b/plugins/gitfast/git-completion.bash
 73index 76ba7e79f0c500ab9a6a3bf60b220225ff79c34a..b93706d177e2b89ef176ce1a4ce9293af065a63c 100644
 74--- a/plugins/gitfast/git-completion.bash
 75+++ b/plugins/gitfast/git-completion.bash
 76@@ -3585,7 +3585,6 @@ __git_func_wrap ()
 77 # This is NOT a public function; use at your own risk.
 78 __git_complete ()
 79 {
 80-	test -n "$ZSH_VERSION" && return
 81 	local wrapper="__git_wrap${2}"
 82 	eval "$wrapper () { __git_func_wrap $2 ; }"
 83 	complete -o bashdefault -o default -o nospace -F $wrapper $1 2>/dev/null \
 84@@ -3607,8 +3606,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
 85 	{
 86 		case "$1" in
 87 		--list-cmds=*)
 88-			IFS=, read -r -a cmds <<< "${1##--list-cmds=}"
 89-			for x in ${cmds[@]}; do
 90+			while read -r -d ',' x; do
 91 				case "$x" in
 92 				nohelpers)
 93 					;;
 94@@ -3620,7 +3618,7 @@ if ! git --list-cmds=main >/dev/null 2>&1; then
 95 					echo ${__git_cmds[$x]}
 96 					;;
 97 				esac
 98-			done
 99+			done <<< "${1##--list-cmds=},"
100 			return
101 			;;
102 		esac