aboutsummaryrefslogtreecommitdiff
path: root/bash/bash_completion.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2016-09-09 00:46:34 +1200
committerTom Ryder <tom@sanctum.geek.nz>2016-09-09 00:46:34 +1200
commitc6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f (patch)
tree9124233c4cc83b63a74cb3341a0d9a963d9d78b7 /bash/bash_completion.d
parentBind Alt+A for cycle completion in Bash (diff)
downloaddotfiles-c6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f.tar.gz
dotfiles-c6f8ddb1620190b6bc5c47cb458f6de1ebf7c73f.zip
Correct ref matching in Git completion
Diffstat (limited to 'bash/bash_completion.d')
-rw-r--r--bash/bash_completion.d/git.bash8
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
;;