diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-09 00:46:34 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-09-09 00:46:34 +1200 |
commit | c6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f (patch) | |
tree | 9124233c4cc83b63a74cb3341a0d9a963d9d78b7 /bash | |
parent | Bind Alt+A for cycle completion in Bash (diff) | |
download | dotfiles-c6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f.tar.gz dotfiles-c6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f.zip |
Correct ref matching in Git completion
Diffstat (limited to 'bash')
-rw-r--r-- | bash/bash_completion.d/git.bash | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/bash/bash_completion.d/git.bash b/bash/bash_completion.d/git.bash index 34a6f5ef..d974f655 100644 --- a/bash/bash_completion.d/git.bash +++ b/bash/bash_completion.d/git.bash @@ -83,10 +83,14 @@ _git() { local ref while IFS= read -r ref ; do [[ -n $ref ]] || continue - COMPREPLY[${#COMPREPLY[@]}]=${ref#refs/*/} + ref=${ref#refs/*/} + case $ref in + "${COMP_WORDS[COMP_CWORD]}"*) + COMPREPLY[${#COMPREPLY[@]}]=$ref + ;; + esac done < <(git for-each-ref \ --format '%(refname)' \ - -- 'refs/**/'"${COMP_WORDS[COMP_CWORD]}"'*' \ 2>/dev/null) return ;; |