Skip to content

Commit 98c6d16

Browse files
dschogitster
authored andcommitted
t4301: verify that merge-tree fails on missing blob objects
We just fixed a problem where `merge-tree` would not fail on missing tree objects. Let's ensure that that problem does not occur with blob objects (and won't, in the future, either). Signed-off-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f30e6c3 commit 98c6d16

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

t/t4301-merge-tree-write-tree.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,4 +962,20 @@ test_expect_success 'error out on missing tree objects' '
962962
test_must_be_empty actual
963963
'
964964

965+
test_expect_success 'error out on missing blob objects' '
966+
echo 1 | git hash-object -w --stdin >blob1 &&
967+
echo 2 | git hash-object -w --stdin >blob2 &&
968+
echo 3 | git hash-object -w --stdin >blob3 &&
969+
printf "100644 blob $(cat blob1)\tblob\n" | git mktree >tree1 &&
970+
printf "100644 blob $(cat blob2)\tblob\n" | git mktree >tree2 &&
971+
printf "100644 blob $(cat blob3)\tblob\n" | git mktree >tree3 &&
972+
git init --bare missing-blob.git &&
973+
cat blob1 blob3 tree1 tree2 tree3 |
974+
git pack-objects missing-blob.git/objects/pack/side1-whatever-is-missing &&
975+
test_must_fail git --git-dir=missing-blob.git >actual 2>err \
976+
merge-tree --merge-base=$(cat tree1) $(cat tree2) $(cat tree3) &&
977+
test_grep "unable to read blob object $(cat blob2)" err &&
978+
test_must_be_empty actual
979+
'
980+
965981
test_done

0 commit comments

Comments
 (0)