completion: query only refs/heads/ in __git_refs_remotes()
__git_refs_remotes() is used to provide completion for refspecs to set 'remote.*.fetch' config variables for branches on the given remote. So it's really only interested in refs under 'refs/heads/', but it queries the remote for all its refs and then filters out all refs outside of 'refs/heads/'. Let 'git ls-remote' do the filtering. Also remove the unused $cmd variable from __git_refs_remotes(). Signed-off-by: SZEDER Gábor <szeder@ira.uka.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fb772cca2b
commit
d79bcf2cf2
@ -651,17 +651,14 @@ __git_refs2 ()
|
|||||||
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
|
# __git_refs_remotes requires 1 argument (to pass to ls-remote)
|
||||||
__git_refs_remotes ()
|
__git_refs_remotes ()
|
||||||
{
|
{
|
||||||
local cmd i is_hash=y
|
local i is_hash=y
|
||||||
for i in $(git ls-remote "$1" 2>/dev/null); do
|
for i in $(git ls-remote "$1" 'refs/heads/*' 2>/dev/null); do
|
||||||
case "$is_hash,$i" in
|
case "$is_hash" in
|
||||||
n,refs/heads/*)
|
n)
|
||||||
is_hash=y
|
is_hash=y
|
||||||
echo "$i:refs/remotes/$1/${i#refs/heads/}"
|
echo "$i:refs/remotes/$1/${i#refs/heads/}"
|
||||||
;;
|
;;
|
||||||
y,*) is_hash=n ;;
|
y) is_hash=n ;;
|
||||||
n,*^{}) is_hash=y ;;
|
|
||||||
n,refs/tags/*) is_hash=y;;
|
|
||||||
n,*) is_hash=y; ;;
|
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user