Merge branch 'll/zsh-complete-git-potty-options' into jch
The zsh completion script (in 'contrib/') has been updated to correctly locate the Git command after global options like '-C' by properly skipping them, similar to how the bash completion does. * ll/zsh-complete-git-potty-options: completion: zsh: support completion after "git -C <path>"jch
commit
b1ca8fdba0
|
|
@ -227,6 +227,7 @@ __git_zsh_main ()
|
||||||
'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
|
'(-p --paginate --no-pager)'{-p,--paginate}'[pipe all output into ''less'']' \
|
||||||
'(-p --paginate)--no-pager[do not pipe git output into a pager]' \
|
'(-p --paginate)--no-pager[do not pipe git output into a pager]' \
|
||||||
'--git-dir=-[set the path to the repository]: :_directories' \
|
'--git-dir=-[set the path to the repository]: :_directories' \
|
||||||
|
'*-C[run as if git was started in <path>]: :_directories' \
|
||||||
'--bare[treat the repository as a bare repository]' \
|
'--bare[treat the repository as a bare repository]' \
|
||||||
'(- :)--version[prints the git suite version]' \
|
'(- :)--version[prints the git suite version]' \
|
||||||
'--exec-path=-[path to where your core git programs are installed]:: :_directories' \
|
'--exec-path=-[path to where your core git programs are installed]:: :_directories' \
|
||||||
|
|
@ -251,7 +252,29 @@ __git_zsh_main ()
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
(arg)
|
(arg)
|
||||||
local command="${words[1]}" __git_dir __git_cmd_idx=1
|
local command="${words[1]}" __git_dir __git_cmd_idx
|
||||||
|
local -a __git_C_args
|
||||||
|
local -i i=2
|
||||||
|
|
||||||
|
while (( i <= $#orig_words )); do
|
||||||
|
case ${orig_words[i]} in
|
||||||
|
-C)
|
||||||
|
__git_C_args+=(-C ${orig_words[i+1]})
|
||||||
|
(( i++ ))
|
||||||
|
;;
|
||||||
|
-c|--git-dir|--work-tree|--namespace)
|
||||||
|
(( i++ ))
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
(( i++ ))
|
||||||
|
done
|
||||||
|
|
||||||
|
__git_cmd_idx=$(( i - 1 ))
|
||||||
|
|
||||||
if (( $+opt_args[--bare] )); then
|
if (( $+opt_args[--bare] )); then
|
||||||
__git_dir='.'
|
__git_dir='.'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue