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:
commit
c5973cb98f
@ -1608,9 +1608,10 @@ static int checkout_main(int argc, const char **argv, const char *prefix,
|
||||
opts->show_progress = -1;
|
||||
|
||||
git_config(git_checkout_config, opts);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
opts->track = BRANCH_TRACK_UNSPECIFIED;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -3976,9 +3976,11 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
|
||||
read_replace_refs = 0;
|
||||
|
||||
sparse = git_env_bool("GIT_TEST_PACK_SPARSE", -1);
|
||||
prepare_repo_settings(the_repository);
|
||||
if (sparse < 0)
|
||||
sparse = the_repository->settings.pack_use_sparse;
|
||||
if (the_repository->gitdir) {
|
||||
prepare_repo_settings(the_repository);
|
||||
if (sparse < 0)
|
||||
sparse = the_repository->settings.pack_use_sparse;
|
||||
}
|
||||
|
||||
reset_pack_idx_option(&pack_idx_opts);
|
||||
git_config(git_pack_config, NULL);
|
||||
|
@ -994,8 +994,10 @@ int cmd_pull(int argc, const char **argv, const char *prefix)
|
||||
set_reflog_message(argc, argv);
|
||||
|
||||
git_config(git_pull_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, pull_options, pull_usage, 0);
|
||||
|
||||
|
@ -139,13 +139,18 @@ test_expect_success 'git help --config-sections-for-completion' '
|
||||
'
|
||||
|
||||
test_expect_success 'generate builtin list' '
|
||||
mkdir -p sub &&
|
||||
git --list-cmds=builtins >builtins
|
||||
'
|
||||
|
||||
while read builtin
|
||||
do
|
||||
test_expect_success "$builtin can handle -h" '
|
||||
test_expect_code 129 git $builtin -h >output 2>&1 &&
|
||||
(
|
||||
GIT_CEILING_DIRECTORIES=$(pwd) &&
|
||||
export GIT_CEILING_DIRECTORIES &&
|
||||
test_expect_code 129 git -C sub $builtin -h >output 2>&1
|
||||
) &&
|
||||
test_i18ngrep usage output
|
||||
'
|
||||
done <builtins
|
||||
|
Loading…
Reference in New Issue
Block a user