aboutsummaryrefslogtreecommitdiff
path: root/bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash')
-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
;;