git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCHv2 4/3] completion: use __gitcomp_nl for ctag matching

From
Jeff King <peff@peff.net>
Date
Oct 21, 2011, 17:37 UTC
Message-ID
<20111021173748.GB24406@sigill.intra.peff.net>
In-Reply-To
<20111021173021.GC24417@sigill.intra.peff.net>
On Fri, Oct 21, 2011 at 01:30:21PM -0400, Jeff King wrote:
> +		if test -r tags; then
> +			__gitcomp "$(__git_match_ctag "$cur" tags)"
> +			return
> +		fi
Once this is merged with sg/complete-refs, this can be applied on top:
-- >8 --
Subject: [PATCH] completion: use __gitcomp_nl for ctag matching

It's much faster than __gitcomp for large numbers of matches (which ctags often have; there are almost 10,000 matches for "" in git.git).

Signed-off-by: Jeff King <peff@peff.net>
---
As an aside, this is one of those patches that is easier to review using
"diff-highlight" from patch 1 of this series.
 contrib/completion/git-completion.bash |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 391c054..53d3dcb 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -1473,7 +1473,7 @@ _git_grep ()
 	case "$cword,$prev" in
 	2,*|*,-*)
 		if test -r tags; then
-			__gitcomp "$(__git_match_ctag "$cur" tags)"
+			__gitcomp_nl "$(__git_match_ctag "$cur" tags)"
 			return
 		fi
 		;;
-- 
1.7.7.rc1.28.g5dd2ee
Previous: Jeff KingNext: SZEDER Gábor
Message 19 of 24 in “stupid git tricks”
  1. 0/3 stupid git tricksJeff King, Oct 18, 2011
  2. 1/3 contrib: add diff highlight scriptJeff King, Oct 18, 2011
  3. 2/3 contrib: add git-jump scriptJeff King, Oct 18, 2011
  4. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 18, 2011
  5. Junio C HamanoOct 18, 2011
  6. Jonathan NiederOct 18, 2011
  7. Junio C HamanoOct 18, 2011
  8. Matthieu MoyOct 18, 2011
  9. Junio C HamanoOct 18, 2011
  10. Jonathan NiederOct 18, 2011
  11. Junio C HamanoOct 18, 2011
  12. Jeff KingOct 18, 2011
  13. SZEDER GáborOct 21, 2011
  14. Jeff KingOct 21, 2011
  15. 1/3 contrib: add diff highlight scriptJeff King, Oct 21, 2011
  16. 2/3 contrib: add git-jump scriptJeff King, Oct 21, 2011
  17. Jeff KingOct 21, 2011
  18. 3/3 completion: match ctags symbol names in grep patternsJeff King, Oct 21, 2011
  19. 4/3 completion: use __gitcomp_nl for ctag matchingJeff King, Oct 21, 2011
  20. SZEDER GáborOct 23, 2011
  21. Jeff KingOct 28, 2011
  22. SZEDER GáborOct 29, 2011
  23. Jeff KingNov 1, 2011
  24. Junio C HamanoNov 1, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.