aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2015-10-21 14:09:47 +1300
committerTom Ryder <tom@sanctum.geek.nz>2015-10-21 14:09:47 +1300
commit78a551f7d24d46560138bf8b846c35f0443f6a0b (patch)
tree3a56f7392eefb18e1caa555df668df25a9a6ae31 /bash/bashrc.d
parentChange COMP_REPLY to intended COMP_WORDS (diff)
downloaddotfiles-78a551f7d24d46560138bf8b846c35f0443f6a0b.tar.gz
dotfiles-78a551f7d24d46560138bf8b846c35f0443f6a0b.zip
Correct enumeration of git refs in completion
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/git.bash3
1 files changed, 2 insertions, 1 deletions
diff --git a/bash/bashrc.d/git.bash b/bash/bashrc.d/git.bash
index 7e0b2028..1f0a78ed 100644
--- a/bash/bashrc.d/git.bash
+++ b/bash/bashrc.d/git.bash
@@ -10,7 +10,8 @@ _git() {
# If the first word is appropriate, complete with branch/tag names
checkout|merge|rebase)
local branch
- while read -r branch ; do
+ while read -r _ _ branch ; do
+ branch=${branch##*/}
[[ $branch == "${COMP_WORDS[COMP_CWORD]}"* ]] || continue
COMPREPLY=("${COMPREPLY[@]}" "$branch")
done < <(git for-each-ref refs/{heads,tags} 2>/dev/null)