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

[PATCH 1/2] completion: fix completion of git <TAB><TAB>

From
Stephen Boyd <bebarino@gmail.com>
Date
Oct 9, 2009, 06:21 UTC
Message-ID
<1255069304-8953-1-git-send-email-bebarino@gmail.com>

After commit 511a3fc (wrap git's main usage string., 2009-09-12), the bash completion for git commands includes COMMAND and [ARGS] when it shouldn't. Fix this by grepping more strictly for a line with git commands. It's doubtful whether git will ever have commands starting with anything besides numbers and letters so this should be fine. At least by being stricter we'll know when we break the completion earlier.

Signed-off-by: Stephen Boyd <bebarino@gmail.com>
---
 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 88b1b3c..652a47c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -496,7 +496,7 @@ __git_all_commands ()
 		return
 	fi
 	local i IFS=" "$'\n'
-	for i in $(git help -a|egrep '^ ')
+	for i in $(git help -a|egrep '^  [a-zA-Z0-9]')
 	do
 		case $i in
 		*--*)             : helper pattern;;
-- 
1.6.5.rc3
Next: Stephen Boyd
Message 1 of 4 in “completion: fix completion of git <TAB><TAB>”
  1. 1/2 completion: fix completion of git <TAB><TAB>Stephen Boyd, Oct 9, 2009
  2. 2/2 completion: fix alias listings with newlinesStephen Boyd, Oct 9, 2009
  3. Shawn O. PearceOct 9, 2009
  4. Shawn O. PearceOct 9, 2009

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.