summaryrefslogtreecommitdiff
path: root/builtin/pack-objects.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-02-18 13:53:30 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-02-18 13:53:30 -0800
commitc5973cb98ff4fe0779e90e04de7c099cc2256a3a (patch)
treed09aedb1405c3b20e31b81c982edf697e4036fbc /builtin/pack-objects.c
parentMerge branch 'tb/midx-no-bitmap-for-no-objects' (diff)
parentt0012: verify that built-ins handle `-h` even without gitdir (diff)
downloadtgif-c5973cb98ff4fe0779e90e04de7c099cc2256a3a.tar.xz
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/pack-objects.c')
-rw-r--r--builtin/pack-objects.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
index ba2006f221..87cb7b45c3 100644
--- a/builtin/pack-objects.c
+++ b/builtin/pack-objects.c
@@ -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);