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>
SZEDER Gábor committed
Oct 8, 2011 at 16:54 UTC
48058f5df49fb9005418a7d025b374988908c0b5
1 file changed
+4
-9
contrib/completion/git-completion.bash
+4
-9
@@ -651,15 +651,10 @@ __git_refs2 ()
651
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
652
__git_refs_remotes ()
653
{
654
- local i is_hash=y
655
- for i in $(git ls-remote "$1" 'refs/heads/*' 2>/dev/null); do
656
- case "$is_hash" in
657
- n)
658
- is_hash=y
659
- echo "$i:refs/remotes/$1/${i#refs/heads/}"
660
- ;;
661
- y) is_hash=n ;;
662
- esac
654
+ local i hash
655
+ git ls-remote "$1" 'refs/heads/*' 2>/dev/null | \
656
+ while read hash i; do
657
+ echo "$i:refs/remotes/$1/${i#refs/heads/}"
658
done
659
}
660