summaryrefslogtreecommitdiff
path: root/contrib/completion
diff options
context:
space:
mode:
authorLibravatar SZEDER Gábor <szeder@ira.uka.de>2011-10-08 16:54:41 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-10-21 14:38:23 -0700
commit48058f5df49fb9005418a7d025b374988908c0b5 (patch)
treed152b6ac1cb3952525fec7111724d5bea00fdb00 /contrib/completion
parentcompletion: query only refs/heads/ in __git_refs_remotes() (diff)
downloadtgif-48058f5df49fb9005418a7d025b374988908c0b5.tar.xz
completion: improve ls-remote output filtering in __git_refs_remotes()
This follows suit of a previous patch for __git_refs(): use a while-read loop and let bash's word splitting get rid of object names from 'git ls-remote's output. Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/completion')
-rwxr-xr-xcontrib/completion/git-completion.bash13
1 files changed, 4 insertions, 9 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 396c8e98f7..f992b1399d 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -651,15 +651,10 @@ __git_refs2 ()
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
__git_refs_remotes ()
{
- 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 ;;
- esac
+ local i hash
+ git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \
+ while read hash i; do
+ echo "$i:refs/remotes/$1/${i#refs/heads/}"
done
}