summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorSZEDER Gábor <szeder@ira.uka.de>2011-10-08 14:54:40 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-10-21 21:38:23 (GMT)
commitd79bcf2cf21ddb8c3fcbd95bafa431f872d47a96 (patch)
treebe97a707136efaa90e99bb94b1f62aea96ae5cb2 /contrib
parentfb772cca2bd38e97a3b23d5b241a8961156b681b (diff)
downloadgit-d79bcf2cf21ddb8c3fcbd95bafa431f872d47a96.zip
git-d79bcf2cf21ddb8c3fcbd95bafa431f872d47a96.tar.gz
git-d79bcf2cf21ddb8c3fcbd95bafa431f872d47a96.tar.bz2
completion: query only refs/heads/ in __git_refs_remotes()
__git_refs_remotes() is used to provide completion for refspecs to set 'remote.*.fetch' config variables for branches on the given remote. So it's really only interested in refs under 'refs/heads/', but it queries the remote for all its refs and then filters out all refs outside of 'refs/heads/'. Let 'git ls-remote' do the filtering. Also remove the unused $cmd variable from __git_refs_remotes(). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/completion/git-completion.bash13
1 files changed, 5 insertions, 8 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 8867e09..396c8e9 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -651,17 +651,14 @@ __git_refs2 ()
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
- local cmd i is_hash=y
- for i in $(git ls-remote "$1" 2>/dev/null); do
- case "$is_hash,$i" in
- n,refs/heads/*)
+ local i is_hash=y
+ for i in $(git ls-remote "$1" 'refs/heads/*' 2>/dev/null); do
+ case "$is_hash" in
+ n)
is_hash=y
echo "$i:refs/remotes/$1/${i#refs/heads/}"
;;
- y,*) is_hash=n ;;
- n,*^{}) is_hash=y ;;
- n,refs/tags/*) is_hash=y;;
- n,*) is_hash=y; ;;
+ y) is_hash=n ;;
esac
done
}