From 48058f5df49fb9005418a7d025b374988908c0b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?SZEDER=20G=C3=A1bor?= Date: Sat, 8 Oct 2011 16:54:41 +0200 Subject: completion: improve ls-remote output filtering in __git_refs_remotes() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- contrib/completion/git-completion.bash | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'contrib/completion') 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 } -- cgit v1.2.3