git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] completion: avoid ls-remote in certain scenarios
@ 2013-05-29  3:20 Felipe Contreras
  2013-05-29  7:44 ` SZEDER Gábor
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Felipe Contreras @ 2013-05-29  3:20 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Felipe Contreras

It's _very_ slow in many cases, and there's really no point in fetching
*everything* from the remote just for completion. In many cases it might
be faster for the user to type the whole thing.

If the user manually specifies 'refs/*', then the full ls-remote
completion is triggered.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 contrib/completion/git-completion.bash | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 1c35eef..2ce4f7d 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -427,14 +427,8 @@ __git_refs ()
 		done
 		;;
 	*)
-		git ls-remote "$dir" HEAD ORIG_HEAD 'refs/tags/*' 'refs/heads/*' 'refs/remotes/*' 2>/dev/null | \
-		while read -r hash i; do
-			case "$i" in
-			*^{}) ;;
-			refs/*) echo "${i#refs/*/}" ;;
-			*) echo "$i" ;;
-			esac
-		done
+		echo "HEAD"
+		git for-each-ref --format="%(refname:short)" -- "refs/remotes/$dir/" | sed -e "s#^$dir/##"
 		;;
 	esac
 }
-- 
1.8.3.rc3.312.g47657de

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-02 22:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-29  3:20 [PATCH] completion: avoid ls-remote in certain scenarios Felipe Contreras
2013-05-29  7:44 ` SZEDER Gábor
2013-06-01 13:58   ` Felipe Contreras
2013-06-01 18:25 ` Ramkumar Ramachandra
2013-06-02 22:08 ` Junio C Hamano
2013-06-02 22:57   ` Felipe Contreras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).