Skip to content

Commit af6fbf9

Browse files
davvidgitster
authored andcommitted
help: Do not unnecessarily look for a repository
Although 'git help' actually doesn't need to be run inside a git repository and uses no repository-specific information, it looks for a git directory. 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 without any options. 7c3baa9 originally modified 'git help -a' to not require a repository. This applies the same fix for 'git help'. Signed-off-by: David Aguilar <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 3c652d1 commit af6fbf9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin-help.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,16 +427,16 @@ int cmd_help(int argc, const char **argv, const char *prefix)
427427
return 0;
428428
}
429429

430-
setup_git_directory_gently(&nongit);
431-
git_config(git_help_config, NULL);
432-
433430
if (!argv[0]) {
434431
printf("usage: %s\n\n", git_usage_string);
435432
list_common_cmds_help();
436433
printf("\n%s\n", git_more_info_string);
437434
return 0;
438435
}
439436

437+
setup_git_directory_gently(&nongit);
438+
git_config(git_help_config, NULL);
439+
440440
alias = alias_lookup(argv[0]);
441441
if (alias && !is_git_command(argv[0])) {
442442
printf("`git %s' is aliased to `%s'\n", argv[0], alias);

0 commit comments

Comments
 (0)