[PATCH 7/9] completion: improve ls-remote output filtering in __git_refs_remotes()
- From
SZEDER Gábor <szeder@ira.uka.de>
- Date
- Oct 8, 2011, 14:54 UTC
- Message-ID
- <1318085683-29830-8-git-send-email-szeder@ira.uka.de>
- In-Reply-To
- <1318085683-29830-1-git-send-email-szeder@ira.uka.de>
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> --- contrib/completion/git-completion.bash | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index dc1d5e90..658df3a7 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -650,15 +650,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 }
-- 1.7.7.187.ga41de