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

Re: Re* t9902 fails

From
Jean-Noël AVILA <avila.jn@gmail.com>
Date
Jan 19, 2013, 13:43 UTC
Message-ID
<201301191443.32661.avila.jn@gmail.com>
In-Reply-To
<7vwqv9obie.fsf_-_@alter.siamese.dyndns.org>
Le samedi 19 janvier 2013 08:52:25, Junio C Hamano a écrit :
Show 5 quoted lines
>  (2) instead of being inclusive, collecting all executable in
>      GIT_EXEC_PATH that happens to be named "git-", add a mode to
>      "git help" that lists those that we know to be standard
>      commands that the users may want to complete from the command
>      line.

Am I wrong when I say that "git help -a" already provides the difference between core git commands and other commands available through path?

If we use this, then we can instruct git-completion that we are in test mode and that it should not provide additional completions.

---
 contrib/completion/git-completion.bash | 13 +++++++++++--
 t/t9902-completion.sh                  |  2 +-
 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-
completion.bash
index 14dd5e7..dc0ea5b 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -23,6 +23,8 @@
 #    3) Consider changing your PS1 to also show the current branch,
 #       see git-prompt.sh for details.
 
+__testing_git=$1
+
 case "$COMP_WORDBREAKS" in
 *:*) : great ;;
 *)   COMP_WORDBREAKS="$COMP_WORDBREAKS:"
@@ -533,8 +535,15 @@ __git_complete_strategy ()
 
 __git_list_all_commands ()
 {
-	local i IFS=" "$'\n'
-	for i in $(git help -a|egrep '^  [a-zA-Z0-9]')
+	local i cmdlist IFS=" "$'\n'
+
+	if [ "x$__testing_git" != "xTEST" ]; then
+		cmdlist=$(git help -a|egrep '^  [a-zA-Z0-9]')
+	else
+		cmdlist=$(git help -a| egrep -m 1 -B1000 PATH | egrep '^  [a-zA-Z0-9]')
+	fi
+
+	for i in $cmdlist
 	do
 		case $i in
 		*--*)             : helper pattern;;
diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh
index 3cd53f8..51463b2 100755
--- a/t/t9902-completion.sh
+++ b/t/t9902-completion.sh
@@ -13,7 +13,7 @@ complete ()
 	return 0
 }
 
-. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash"
+. "$GIT_BUILD_DIR/contrib/completion/git-completion.bash" TEST
 
 # We don't need this function to actually join words or do anything special.
 # Also, it's cleaner to avoid touching bash's internal completion variables.
-- 
1.8.1.1.271.g02f55e6
Previous: Jean-Noël AVILANext: Jean-Noël AVILA
Message 23 of 32 in “attr: fix off-by-one directory component length calculation”
  1. attr: fix off-by-one directory component length calculationNguyễn Thái Ngọc Duy, Jan 15, 2013
  2. Junio C HamanoJan 15, 2013
  3. Jean-Noël AVILAJan 15, 2013
  4. Junio C HamanoJan 15, 2013
  5. Jean-Noël AVILAJan 15, 2013
  6. Junio C HamanoJan 15, 2013
  7. Jeff KingJan 15, 2013
  8. Torsten BögershausenJan 16, 2013
  9. Jean-Noël AVILAJan 17, 2013
  10. Jonathan NiederJan 18, 2013
  11. Junio C HamanoJan 18, 2013
  12. Torsten BögershausenJan 18, 2013
  13. Junio C HamanoJan 18, 2013
  14. Junio C HamanoJan 18, 2013
  15. Jean-Noël AVILAJan 18, 2013
  16. Junio C HamanoJan 18, 2013
  17. Junio C HamanoJan 18, 2013
  18. Torsten BögershausenJan 19, 2013
  19. Re* t9902 failsJunio C Hamano, Jan 19, 2013
  20. 1/2 help: include <common-cmds.h> only in one fileJunio C Hamano, Jan 19, 2013
  21. 2/2 help --standard: list standard commandsJunio C Hamano, Jan 19, 2013
  22. Jean-Noël AVILAJan 19, 2013
  23. Jean-Noël AVILAJan 19, 2013
  24. Jean-Noël AVILAJan 19, 2013
  25. Duy NguyenJan 16, 2013
  26. Duy NguyenJan 16, 2013
  27. Junio C HamanoJan 16, 2013
  28. Duy NguyenJan 16, 2013
  29. Junio C HamanoJan 16, 2013
  30. Duy NguyenJan 16, 2013
  31. Junio C HamanoJan 16, 2013
  32. Duy NguyenJan 16, 2013

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.