diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index 8cb32763b7..f513138513 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -3122,6 +3122,7 @@ static void read_packs_list_from_stdin(void) revs.blob_objects = 1; revs.tree_objects = 1; revs.tag_objects = 1; + revs.ignore_missing_links = 1; while (strbuf_getline(&buf, stdin) != EOF) { if (!buf.len) diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 7138a54595..ab509e8c38 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -629,4 +629,42 @@ test_expect_success '--stdin-packs with loose objects' ' ) ' +test_expect_success '--stdin-packs with broken links' ' + ( + cd stdin-packs && + + # make an unreachable object with a bogus parent + git cat-file -p HEAD >commit && + sed "s/$(git rev-parse HEAD^)/$(test_oid zero)/" in && + + git pack-objects .git/objects/pack/pack-D expect.raw && + git show-index <$(ls test3-*.idx) >actual.raw && + + cut -d" " -f2 expect && + cut -d" " -f2 actual && + test_cmp expect actual + ) +' + test_done