summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--builtin/index-pack.c8
-rwxr-xr-xt/t7415-submodule-names.sh10
2 files changed, 16 insertions, 2 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 7b2f7c0470..7b399478dd 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1480,8 +1480,12 @@ static void final(const char *final_pack_name, const char *curr_pack_name,
} else
chmod(final_index_name, 0444);
- if (do_fsck_object)
- add_packed_git(final_index_name, strlen(final_index_name), 0);
+ if (do_fsck_object) {
+ struct packed_git *p;
+ p = add_packed_git(final_index_name, strlen(final_index_name), 0);
+ if (p)
+ install_packed_git(the_repository, p);
+ }
if (!from_stdin) {
printf("%s\n", sha1_to_hex(hash));
diff --git a/t/t7415-submodule-names.sh b/t/t7415-submodule-names.sh
index a770d92a55..4157e1a134 100755
--- a/t/t7415-submodule-names.sh
+++ b/t/t7415-submodule-names.sh
@@ -122,6 +122,16 @@ test_expect_success 'transfer.fsckObjects handles odd pack (index)' '
test_must_fail git -C dst.git index-pack --strict --stdin <odd.pack
'
+test_expect_success 'index-pack --strict works for non-repo pack' '
+ rm -rf dst.git &&
+ git init --bare dst.git &&
+ cp odd.pack dst.git &&
+ test_must_fail git -C dst.git index-pack --strict odd.pack 2>output &&
+ # Make sure we fail due to bad gitmodules content, not because we
+ # could not read the blob in the first place.
+ grep gitmodulesName output
+'
+
test_expect_success 'fsck detects symlinked .gitmodules file' '
git init symlink &&
(