diff --git a/commit.c b/commit.c index 00c99c7272..9e49c221ed 100644 --- a/commit.c +++ b/commit.c @@ -196,6 +196,9 @@ static void prepare_commit_graft(void) if (commit_graft_prepared) return; + if (!startup_info->have_repository) + return; + graft_file = get_graft_file(); read_graft_file(graft_file); /* make sure shallows are read */ diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 9c68b99251..88ec5d7848 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -421,6 +421,12 @@ test_expect_success 'index-pack works in non-repo' ' test_path_is_file foo.idx ' +test_expect_success 'index-pack --strict works in non-repo' ' + rm -f foo.idx && + nongit git index-pack --strict ../foo.pack && + test_path_is_file foo.idx +' + test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'index-pack --threads=N or pack.threads=N warns when no pthreads' ' test_must_fail git index-pack --threads=2 2>err && grep ^warning: err >warnings &&