Skip to content

Commit

Permalink
completion: improve ls-remote output filtering in __git_refs_remotes()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
SZEDER Gábor authored and Junio C Hamano committed Oct 21, 2011
1 parent d79bcf2 commit 48058f5
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions contrib/completion/git-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 48058f5

Please sign in to comment.