summaryrefslogtreecommitdiff
path: root/builtin/fetch.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-02-18 13:53:30 -0800
committerJunio C Hamano <gitster@pobox.com>2022-02-18 13:53:30 -0800
commitc5973cb98ff4fe0779e90e04de7c099cc2256a3a (patch)
treed09aedb1405c3b20e31b81c982edf697e4036fbc /builtin/fetch.c
parent9b7e531f94c610439cff3c8d4556742524184463 (diff)
parent87ad07d735448a72d4e1fc4f3ce1e6b44bc613f5 (diff)
downloadgit-c5973cb98ff4fe0779e90e04de7c099cc2256a3a.tar.gz
Merge branch 'js/short-help-outside-repo-fix'
"git cmd -h" outside a repository should error out cleanly for many commands, but instead it hit a BUG(), which has been corrected. * js/short-help-outside-repo-fix: t0012: verify that built-ins handle `-h` even without gitdir checkout/fetch/pull/pack-objects: allow `-h` outside a repository
Diffstat (limited to 'builtin/fetch.c')
-rw-r--r--builtin/fetch.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/builtin/fetch.c b/builtin/fetch.c
index ada4059fe8..5583f71ef3 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -2017,8 +2017,10 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
}
git_config(git_fetch_config, NULL);
- prepare_repo_settings(the_repository);
- the_repository->settings.command_requires_full_index = 0;
+ if (the_repository->gitdir) {
+ prepare_repo_settings(the_repository);
+ the_repository->settings.command_requires_full_index = 0;
+ }
argc = parse_options(argc, argv, prefix,
builtin_fetch_options, builtin_fetch_usage, 0);