From 25fcf3e988c30ef64d6555e0511371647390277f Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 6 Dec 2018 13:51:57 +1300 Subject: Add actual completion matching to git completion Doi. --- bash/bash_completion.d/git.bash | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'bash') diff --git a/bash/bash_completion.d/git.bash b/bash/bash_completion.d/git.bash index 450160fc..ea5e00cd 100644 --- a/bash/bash_completion.d/git.bash +++ b/bash/bash_completion.d/git.bash @@ -15,7 +15,10 @@ _git() { 98) local ci while read -r _ ref ; do - COMPREPLY[ci++]=${ref#refs/heads/} + branch=${ref#refs/heads/} + case $branch in + "$2"*) COMPREPLY[ci++]=$branch ;; + esac done < <(git show-ref --heads) ;; @@ -23,7 +26,10 @@ _git() { 116) local ci while read -r _ ref ; do - COMPREPLY[ci++]=${ref#refs/tags/} + tag=${ref#refs/tags/} + case $tag in + "$2"*) COMPREPLY[ci++]=$tag ;; + esac done < <(git show-ref --tags) ;; -- cgit v1.2.3