Skip to content

Commit 48058f5

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent d79bcf2 commit 48058f5

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

contrib/completion/git-completion.bash

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -651,15 +651,10 @@ __git_refs2 ()
651651
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
652652
__git_refs_remotes ()
653653
{
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/}"
663658
done
664659
}
665660

0 commit comments

Comments
 (0)