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

[PATCH 2/2] git-completion.bash: prevent 'git help' from searching for git repository

From
Gerrit Pape <pape@smarden.org>
Date
Sep 4, 2009, 09:29 UTC
Message-ID
<20090904092929.23208.qmail@00cf3567a0e8b4.315fe32.mid.smarden.org>
In-Reply-To
<fabb9a1e0909020447p212594cake8c6fe3a43b667ec@mail.gmail.com>

On 'git <TAB><TAB>' the bash completion runs 'git help -a'. Since 'git help' actually doesn't need to be run inside a git repository, this commit uses the --no-git-dir option to prevent it from searching a git directory. Unnecessary searching for a git directory can be annoying in auto-mount environments.

The annoying behavior and suggested fix has been reported by Vincent
Danjean through
 http://bugs.debian.org/539273
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
 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 bf688e1..a55e3cd 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -500,7 +500,7 @@ __git_all_commands ()
 		return
 	fi
 	local i IFS=" "$'\n'
-	for i in $(git help -a|egrep '^ ')
+	for i in $(git --no-git-dir help -a|egrep '^ ')
 	do
 		case $i in
 		*--*)             : helper pattern;;
-- 
1.6.0.3
Previous: Gerrit PapeNext: Junio C Hamano
Message 4 of 17 in “git-completion.bash: prevent 'git help' from searching for git repository”
  1. git-completion.bash: prevent 'git help' from searching for git repositoryGerrit Pape, Sep 2, 2009
  2. Sverre RabbelierSep 2, 2009
  3. 1/2 git: add new option --no-git-dirGerrit Pape, Sep 4, 2009
  4. 2/2 git-completion.bash: prevent 'git help' from searching for git repositoryGerrit Pape, Sep 4, 2009
  5. Junio C HamanoSep 4, 2009
  6. Johannes SchindelinSep 4, 2009
  7. Gerrit PapeSep 4, 2009
  8. Johannes SchindelinSep 4, 2009
  9. Gerrit PapeSep 4, 2009
  10. Johannes SchindelinSep 4, 2009
  11. Junio C HamanoSep 7, 2009
  12. Gerrit PapeOct 27, 2009
  13. Junio C HamanoOct 28, 2009
  14. help -a: do not unnecessarily look for a repositoryGerrit Pape, Oct 28, 2009
  15. Junio C HamanoOct 28, 2009
  16. Rogan DawesSep 4, 2009
  17. Johannes SchindelinSep 4, 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.