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

[PATCH] help -a: do not unnecessarily look for a repository

From
Gerrit Pape <pape@smarden.org>
Date
Oct 28, 2009, 09:30 UTC
Message-ID
<20091028093022.30253.qmail@d8110c1e8cdcdf.315fe32.mid.smarden.org>
In-Reply-To
<7viqe0yrnu.fsf@alter.siamese.dyndns.org>

Although 'git help -a' actually doesn't need to be run inside a git repository and uses no repository-specific information, it looks for a git directory. On 'git <TAB><TAB>' the bash completion runs 'git help -a' and unnecessary searching for a git directory can be annoying in auto-mount environments. With this commit, 'git help' no longer searches for a repository when run with the -a option.

The fix is from Johannes Schindelin, the annoying behavior has been
reported by Vincent Danjean through
 http://bugs.debian.org/539273
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
On Tue, Oct 27, 2009 at 11:11:01PM -0700, Junio C Hamano wrote:
> Gerrit Pape <pape@smarden.org> writes:
> > Hi Junio, I suggest to apply this patch from Johannes to master.
Show 5 quoted lines
> Could you help by coming up with a suitable log message?
>
> It's a bit too much to ask me to hunt for ancient discussion to
> correct the <<all the ack go here>> myself to describe what the
> issue was,
Sure, sorry for that.  Regards, Gerrit.
 builtin-help.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin-help.c b/builtin-help.c
index e1ade8e..ca08519 100644
--- a/builtin-help.c
+++ b/builtin-help.c
@@ -417,9 +417,6 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 	const char *alias;
 	load_command_list("git-", &main_cmds, &other_cmds);
 
-	setup_git_directory_gently(&nongit);
-	git_config(git_help_config, NULL);
-
 	argc = parse_options(argc, argv, prefix, builtin_help_options,
 			builtin_help_usage, 0);
 
@@ -430,6 +427,9 @@ int cmd_help(int argc, const char **argv, const char *prefix)
 		return 0;
 	}
 
+	setup_git_directory_gently(&nongit);
+	git_config(git_help_config, NULL);
+
 	if (!argv[0]) {
 		printf("usage: %s\n\n", git_usage_string);
 		list_common_cmds_help();
-- 
1.6.5.2
Previous: Junio C HamanoNext: Junio C Hamano
Message 14 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.