From: SZEDER Gábor Date: Sat, 8 Oct 2011 14:54:42 +0000 (+0200) Subject: completion: fast initial completion for config 'remote.*.fetch' value X-Git-Tag: v1.7.9-rc0~81^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=d51a8ecd5fedb6fd09a14fc1b07f8922d6963743;p=git.git completion: fast initial completion for config 'remote.*.fetch' value Refspecs for branches in a remote repository start with 'refs/heads/', so completing those refspecs with 'git config remote.origin.fetch ' always offers 'refs/heads/' first, because that's the unique part of the possible refspecs. But it does so only after querying the remote with 'git ls-remote', which can take a while when the request goes through some slower network to a remote server. Don't waste the user's time and offer 'refs/heads/' right away for 'git config remote.origin.fetch '. The reason for putting 'refs/heads/' directly into COMPREPLY instead of using __gitcomp() is to avoid __gitcomp() adding a trailing space. Signed-off-by: SZEDER Gábor Signed-off-by: Junio C Hamano --- diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index f992b1399..c76b645be 100755 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -1891,6 +1891,10 @@ _git_config () remote.*.fetch) local remote="${prev#remote.}" remote="${remote%.fetch}" + if [ -z "$cur" ]; then + COMPREPLY=("refs/heads/") + return + fi __gitcomp_nl "$(__git_refs_remotes "$remote")" return ;;