First enter git stash show .
Then enter s and tab and it will show git stash show stash@ { , so far it works fine.
But after entering 1 and tab, it becomes git stash show stashstash@ {1} , and this is obviously wrong.
I think there might be something wrong with the following code in .git-completion.bash , but I can hardly read it.
_git_stash () { local save_opts='--keep-index --no-keep-index --quiet --patch' local subcommands='save list show apply clear drop pop create branch' local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then case "$cur" in --*) __gitcomp "$save_opts" ;; *) if [ -z "$(__git_find_on_cmdline "$save_opts")" ]; then __gitcomp "$subcommands" else COMPREPLY=() fi ;; esac else case "$subcommand,$cur" in save,--*) __gitcomp "$save_opts" ;; apply,--*|pop,--*) __gitcomp "--index --quiet" ;; show,--*|drop,--*|branch,--*) COMPREPLY=() ;; show,*|apply,*|drop,*|pop,*|branch,*) __gitcomp_nl "$(git --git-dir="$(__gitdir)" stash list \ | sed -n -e 's/:.*//p')" ;; *) COMPREPLY=() ;; esac fi }
Does anyone know how to fix this?
Bash version: GNU bash, version 4.2.37 (2) -release (i386-apple-darwin12.0.0).
git version: 1.8.0.3
whole source: https://gist.github.com/pktangyue/5477924
source share