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
This commit is contained in:
Junio C Hamano
2022-02-18 13:53:30 -08:00
5 changed files with 23 additions and 11 deletions

View File

@ -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);