3 test_description='commit graph'
6 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
8 test_expect_success 'setup full repo' '
10 cd "$TRASH_DIRECTORY/full" &&
12 git config core.commitGraph true &&
13 objdir=".git/objects" &&
17 test_expect_success POSIXPERM 'tweak umask for modebit tests' '
21 test_expect_success 'verify graph with no graph file' '
22 cd "$TRASH_DIRECTORY/full" &&
23 git commit-graph verify
26 test_expect_success 'write graph with no packs' '
27 cd "$TRASH_DIRECTORY/full" &&
28 git commit-graph write --object-dir $objdir &&
29 test_path_is_missing $objdir/info/commit-graph
32 test_expect_success 'exit with correct error on bad input to --stdin-packs' '
33 cd "$TRASH_DIRECTORY/full" &&
34 echo doesnotexist >in &&
35 test_expect_code 1 git commit-graph write --stdin-packs <in 2>stderr &&
36 test_i18ngrep "error adding pack" stderr
39 test_expect_success 'create commits and repack' '
40 cd "$TRASH_DIRECTORY/full" &&
41 for i in $(test_seq 3)
49 test_expect_success 'exit with correct error on bad input to --stdin-commits' '
50 cd "$TRASH_DIRECTORY/full" &&
51 echo HEAD | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr &&
52 test_i18ngrep "unexpected non-hex object ID: HEAD" stderr &&
53 # valid tree OID, but not a commit OID
54 git rev-parse HEAD^{tree} | test_expect_code 1 git commit-graph write --stdin-commits 2>stderr &&
55 test_i18ngrep "invalid commit object id" stderr
58 graph_git_two_modes() {
59 git -c core.commitGraph=true $1 >output
60 git -c core.commitGraph=false $1 >expect
61 test_cmp expect output
64 graph_git_behavior() {
69 test_expect_success "check normal git operations: $MSG" '
70 cd "$TRASH_DIRECTORY/$DIR" &&
71 graph_git_two_modes "log --oneline $BRANCH" &&
72 graph_git_two_modes "log --topo-order $BRANCH" &&
73 graph_git_two_modes "log --graph $COMPARE..$BRANCH" &&
74 graph_git_two_modes "branch -vv" &&
75 graph_git_two_modes "merge-base -a $BRANCH $COMPARE"
79 graph_git_behavior 'no graph' full commits/3 commits/1
87 NUM_CHUNKS=$((3 + $(echo "$2" | wc -w)))
90 header: 43475048 1 1 $NUM_CHUNKS 0
92 chunks: oid_fanout oid_lookup commit_metadata$OPTIONAL
94 test-tool read-graph >output &&
95 test_cmp expect output
98 test_expect_success 'write graph' '
99 cd "$TRASH_DIRECTORY/full" &&
100 git commit-graph write &&
101 test_path_is_file $objdir/info/commit-graph &&
102 graph_read_expect "3"
105 test_expect_success POSIXPERM 'write graph has correct permissions' '
106 test_path_is_file $objdir/info/commit-graph &&
107 echo "-r--r--r--" >expect &&
108 test_modebits $objdir/info/commit-graph >actual &&
109 test_cmp expect actual
112 graph_git_behavior 'graph exists' full commits/3 commits/1
114 test_expect_success 'Add more commits' '
115 cd "$TRASH_DIRECTORY/full" &&
116 git reset --hard commits/1 &&
117 for i in $(test_seq 4 5)
120 git branch commits/$i
122 git reset --hard commits/2 &&
123 for i in $(test_seq 6 7)
126 git branch commits/$i
128 git reset --hard commits/2 &&
129 git merge commits/4 &&
130 git branch merge/1 &&
131 git reset --hard commits/4 &&
132 git merge commits/6 &&
133 git branch merge/2 &&
134 git reset --hard commits/3 &&
135 git merge commits/5 commits/7 &&
136 git branch merge/3 &&
140 test_expect_success 'commit-graph write progress off for redirected stderr' '
141 cd "$TRASH_DIRECTORY/full" &&
142 git commit-graph write 2>err &&
143 test_line_count = 0 err
146 test_expect_success 'commit-graph write force progress on for stderr' '
147 cd "$TRASH_DIRECTORY/full" &&
148 GIT_PROGRESS_DELAY=0 git commit-graph write --progress 2>err &&
149 test_file_not_empty err
152 test_expect_success 'commit-graph write with the --no-progress option' '
153 cd "$TRASH_DIRECTORY/full" &&
154 git commit-graph write --no-progress 2>err &&
155 test_line_count = 0 err
158 test_expect_success 'commit-graph verify progress off for redirected stderr' '
159 cd "$TRASH_DIRECTORY/full" &&
160 git commit-graph verify 2>err &&
161 test_line_count = 0 err
164 test_expect_success 'commit-graph verify force progress on for stderr' '
165 cd "$TRASH_DIRECTORY/full" &&
166 GIT_PROGRESS_DELAY=0 git commit-graph verify --progress 2>err &&
167 test_file_not_empty err
170 test_expect_success 'commit-graph verify with the --no-progress option' '
171 cd "$TRASH_DIRECTORY/full" &&
172 git commit-graph verify --no-progress 2>err &&
173 test_line_count = 0 err
176 # Current graph structure:
186 test_expect_success 'write graph with merges' '
187 cd "$TRASH_DIRECTORY/full" &&
188 git commit-graph write &&
189 test_path_is_file $objdir/info/commit-graph &&
190 graph_read_expect "10" "extra_edges"
193 graph_git_behavior 'merge 1 vs 2' full merge/1 merge/2
194 graph_git_behavior 'merge 1 vs 3' full merge/1 merge/3
195 graph_git_behavior 'merge 2 vs 3' full merge/2 merge/3
197 test_expect_success 'Add one more commit' '
198 cd "$TRASH_DIRECTORY/full" &&
200 git branch commits/8 &&
201 ls $objdir/pack | grep idx >existing-idx &&
203 ls $objdir/pack| grep idx | grep -v -f existing-idx >new-idx
206 # Current graph structure:
218 graph_git_behavior 'mixed mode, commit 8 vs merge 1' full commits/8 merge/1
219 graph_git_behavior 'mixed mode, commit 8 vs merge 2' full commits/8 merge/2
221 test_expect_success 'write graph with new commit' '
222 cd "$TRASH_DIRECTORY/full" &&
223 git commit-graph write &&
224 test_path_is_file $objdir/info/commit-graph &&
225 graph_read_expect "11" "extra_edges"
228 graph_git_behavior 'full graph, commit 8 vs merge 1' full commits/8 merge/1
229 graph_git_behavior 'full graph, commit 8 vs merge 2' full commits/8 merge/2
231 test_expect_success 'write graph with nothing new' '
232 cd "$TRASH_DIRECTORY/full" &&
233 git commit-graph write &&
234 test_path_is_file $objdir/info/commit-graph &&
235 graph_read_expect "11" "extra_edges"
238 graph_git_behavior 'cleared graph, commit 8 vs merge 1' full commits/8 merge/1
239 graph_git_behavior 'cleared graph, commit 8 vs merge 2' full commits/8 merge/2
241 test_expect_success 'build graph from latest pack with closure' '
242 cd "$TRASH_DIRECTORY/full" &&
243 cat new-idx | git commit-graph write --stdin-packs &&
244 test_path_is_file $objdir/info/commit-graph &&
245 graph_read_expect "9" "extra_edges"
248 graph_git_behavior 'graph from pack, commit 8 vs merge 1' full commits/8 merge/1
249 graph_git_behavior 'graph from pack, commit 8 vs merge 2' full commits/8 merge/2
251 test_expect_success 'build graph from commits with closure' '
252 cd "$TRASH_DIRECTORY/full" &&
253 git tag -a -m "merge" tag/merge merge/2 &&
254 git rev-parse tag/merge >commits-in &&
255 git rev-parse merge/1 >>commits-in &&
256 cat commits-in | git commit-graph write --stdin-commits &&
257 test_path_is_file $objdir/info/commit-graph &&
258 graph_read_expect "6"
261 graph_git_behavior 'graph from commits, commit 8 vs merge 1' full commits/8 merge/1
262 graph_git_behavior 'graph from commits, commit 8 vs merge 2' full commits/8 merge/2
264 test_expect_success 'build graph from commits with append' '
265 cd "$TRASH_DIRECTORY/full" &&
266 git rev-parse merge/3 | git commit-graph write --stdin-commits --append &&
267 test_path_is_file $objdir/info/commit-graph &&
268 graph_read_expect "10" "extra_edges"
271 graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
272 graph_git_behavior 'append graph, commit 8 vs merge 2' full commits/8 merge/2
274 test_expect_success 'build graph using --reachable' '
275 cd "$TRASH_DIRECTORY/full" &&
276 git commit-graph write --reachable &&
277 test_path_is_file $objdir/info/commit-graph &&
278 graph_read_expect "11" "extra_edges"
281 graph_git_behavior 'append graph, commit 8 vs merge 1' full commits/8 merge/1
282 graph_git_behavior 'append graph, commit 8 vs merge 2' full commits/8 merge/2
284 test_expect_success 'setup bare repo' '
285 cd "$TRASH_DIRECTORY" &&
286 git clone --bare --no-local full bare &&
288 git config core.commitGraph true &&
292 graph_git_behavior 'bare repo, commit 8 vs merge 1' bare commits/8 merge/1
293 graph_git_behavior 'bare repo, commit 8 vs merge 2' bare commits/8 merge/2
295 test_expect_success 'write graph in bare repo' '
296 cd "$TRASH_DIRECTORY/bare" &&
297 git commit-graph write &&
298 test_path_is_file $baredir/info/commit-graph &&
299 graph_read_expect "11" "extra_edges"
302 graph_git_behavior 'bare repo with graph, commit 8 vs merge 1' bare commits/8 merge/1
303 graph_git_behavior 'bare repo with graph, commit 8 vs merge 2' bare commits/8 merge/2
305 test_expect_success 'perform fast-forward merge in full repo' '
306 cd "$TRASH_DIRECTORY/full" &&
307 git checkout -b merge-5-to-8 commits/5 &&
308 git merge commits/8 &&
309 git show-ref -s merge-5-to-8 >output &&
310 git show-ref -s commits/8 >expect &&
311 test_cmp expect output
314 test_expect_success 'check that gc computes commit-graph' '
315 cd "$TRASH_DIRECTORY/full" &&
316 git commit --allow-empty -m "blank" &&
317 git commit-graph write --reachable &&
318 cp $objdir/info/commit-graph commit-graph-before-gc &&
319 git reset --hard HEAD~1 &&
320 git config gc.writeCommitGraph true &&
322 cp $objdir/info/commit-graph commit-graph-after-gc &&
323 ! test_cmp_bin commit-graph-before-gc commit-graph-after-gc &&
324 git commit-graph write --reachable &&
325 test_cmp_bin commit-graph-after-gc $objdir/info/commit-graph
328 test_expect_success 'replace-objects invalidates commit-graph' '
329 cd "$TRASH_DIRECTORY" &&
330 test_when_finished rm -rf replace &&
331 git clone full replace &&
334 git commit-graph write --reachable &&
335 test_path_is_file .git/objects/info/commit-graph &&
336 git replace HEAD~1 HEAD~2 &&
337 git -c core.commitGraph=false log >expect &&
338 git -c core.commitGraph=true log >actual &&
339 test_cmp expect actual &&
340 git commit-graph write --reachable &&
341 git -c core.commitGraph=false --no-replace-objects log >expect &&
342 git -c core.commitGraph=true --no-replace-objects log >actual &&
343 test_cmp expect actual &&
344 rm -rf .git/objects/info/commit-graph &&
345 git commit-graph write --reachable &&
346 test_path_is_file .git/objects/info/commit-graph
350 test_expect_success 'commit grafts invalidate commit-graph' '
351 cd "$TRASH_DIRECTORY" &&
352 test_when_finished rm -rf graft &&
353 git clone full graft &&
356 git commit-graph write --reachable &&
357 test_path_is_file .git/objects/info/commit-graph &&
358 H1=$(git rev-parse --verify HEAD~1) &&
359 H3=$(git rev-parse --verify HEAD~3) &&
360 echo "$H1 $H3" >.git/info/grafts &&
361 git -c core.commitGraph=false log >expect &&
362 git -c core.commitGraph=true log >actual &&
363 test_cmp expect actual &&
364 git commit-graph write --reachable &&
365 git -c core.commitGraph=false --no-replace-objects log >expect &&
366 git -c core.commitGraph=true --no-replace-objects log >actual &&
367 test_cmp expect actual &&
368 rm -rf .git/objects/info/commit-graph &&
369 git commit-graph write --reachable &&
370 test_path_is_missing .git/objects/info/commit-graph
374 test_expect_success 'replace-objects invalidates commit-graph' '
375 cd "$TRASH_DIRECTORY" &&
376 test_when_finished rm -rf shallow &&
377 git clone --depth 2 "file://$TRASH_DIRECTORY/full" shallow &&
380 git commit-graph write --reachable &&
381 test_path_is_missing .git/objects/info/commit-graph &&
382 git fetch origin --unshallow &&
383 git commit-graph write --reachable &&
384 test_path_is_file .git/objects/info/commit-graph
388 # the verify tests below expect the commit-graph to contain
389 # exactly the commits reachable from the commits/8 branch.
390 # If the file changes the set of commits in the list, then the
391 # offsets into the binary file will result in different edits
392 # and the tests will likely break.
394 test_expect_success 'git commit-graph verify' '
395 cd "$TRASH_DIRECTORY/full" &&
396 git rev-parse commits/8 | git commit-graph write --stdin-commits &&
397 git commit-graph verify >output
402 HASH_LEN="$(test_oid rawsz)"
405 GRAPH_BYTE_CHUNK_COUNT=6
406 GRAPH_CHUNK_LOOKUP_OFFSET=8
407 GRAPH_CHUNK_LOOKUP_WIDTH=12
408 GRAPH_CHUNK_LOOKUP_ROWS=5
409 GRAPH_BYTE_OID_FANOUT_ID=$GRAPH_CHUNK_LOOKUP_OFFSET
410 GRAPH_BYTE_OID_LOOKUP_ID=$(($GRAPH_CHUNK_LOOKUP_OFFSET + \
411 1 * $GRAPH_CHUNK_LOOKUP_WIDTH))
412 GRAPH_BYTE_COMMIT_DATA_ID=$(($GRAPH_CHUNK_LOOKUP_OFFSET + \
413 2 * $GRAPH_CHUNK_LOOKUP_WIDTH))
414 GRAPH_FANOUT_OFFSET=$(($GRAPH_CHUNK_LOOKUP_OFFSET + \
415 $GRAPH_CHUNK_LOOKUP_WIDTH * $GRAPH_CHUNK_LOOKUP_ROWS))
416 GRAPH_BYTE_FANOUT1=$(($GRAPH_FANOUT_OFFSET + 4 * 4))
417 GRAPH_BYTE_FANOUT2=$(($GRAPH_FANOUT_OFFSET + 4 * 255))
418 GRAPH_OID_LOOKUP_OFFSET=$(($GRAPH_FANOUT_OFFSET + 4 * 256))
419 GRAPH_BYTE_OID_LOOKUP_ORDER=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * 8))
420 GRAPH_BYTE_OID_LOOKUP_MISSING=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * 4 + 10))
421 GRAPH_COMMIT_DATA_OFFSET=$(($GRAPH_OID_LOOKUP_OFFSET + $HASH_LEN * $NUM_COMMITS))
422 GRAPH_BYTE_COMMIT_TREE=$GRAPH_COMMIT_DATA_OFFSET
423 GRAPH_BYTE_COMMIT_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN))
424 GRAPH_BYTE_COMMIT_EXTRA_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 4))
425 GRAPH_BYTE_COMMIT_WRONG_PARENT=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 3))
426 GRAPH_BYTE_COMMIT_GENERATION=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 11))
427 GRAPH_BYTE_COMMIT_DATE=$(($GRAPH_COMMIT_DATA_OFFSET + $HASH_LEN + 12))
428 GRAPH_COMMIT_DATA_WIDTH=$(($HASH_LEN + 16))
429 GRAPH_OCTOPUS_DATA_OFFSET=$(($GRAPH_COMMIT_DATA_OFFSET + \
430 $GRAPH_COMMIT_DATA_WIDTH * $NUM_COMMITS))
431 GRAPH_BYTE_OCTOPUS=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4))
432 GRAPH_BYTE_FOOTER=$(($GRAPH_OCTOPUS_DATA_OFFSET + 4 * $NUM_OCTOPUS_EDGES))
434 corrupt_graph_setup() {
435 cd "$TRASH_DIRECTORY/full" &&
436 test_when_finished mv commit-graph-backup $objdir/info/commit-graph &&
437 cp $objdir/info/commit-graph commit-graph-backup &&
438 chmod u+w $objdir/info/commit-graph
441 corrupt_graph_verify() {
443 test_must_fail git commit-graph verify 2>test_err &&
444 grep -v "^+" test_err >err &&
445 test_i18ngrep "$grepstr" err &&
446 if test "$2" != "no-copy"
448 cp $objdir/info/commit-graph commit-graph-pre-write-test
450 git status --short &&
451 GIT_TEST_COMMIT_GRAPH_DIE_ON_LOAD=true git commit-graph write &&
452 chmod u+w $objdir/info/commit-graph &&
453 git commit-graph verify
456 # usage: corrupt_graph_and_verify <position> <data> <string> [<zero_pos>]
457 # Manipulates the commit-graph file at the position
458 # by inserting the data, optionally zeroing the file
459 # starting at <zero_pos>, then runs 'git commit-graph verify'
460 # and places the output in the file 'err'. Test 'err' for
462 corrupt_graph_and_verify() {
466 corrupt_graph_setup &&
467 orig_size=$(wc -c < $objdir/info/commit-graph) &&
468 zero_pos=${4:-${orig_size}} &&
469 printf "$data" | dd of="$objdir/info/commit-graph" bs=1 seek="$pos" conv=notrunc &&
470 dd of="$objdir/info/commit-graph" bs=1 seek="$zero_pos" if=/dev/null &&
471 generate_zero_bytes $(($orig_size - $zero_pos)) >>"$objdir/info/commit-graph" &&
472 corrupt_graph_verify "$grepstr"
476 test_expect_success POSIXPERM,SANITY 'detect permission problem' '
477 corrupt_graph_setup &&
478 chmod 000 $objdir/info/commit-graph &&
479 corrupt_graph_verify "Could not open" "no-copy"
482 test_expect_success 'detect too small' '
483 corrupt_graph_setup &&
484 echo "a small graph" >$objdir/info/commit-graph &&
485 corrupt_graph_verify "too small"
488 test_expect_success 'detect bad signature' '
489 corrupt_graph_and_verify 0 "\0" \
493 test_expect_success 'detect bad version' '
494 corrupt_graph_and_verify $GRAPH_BYTE_VERSION "\02" \
498 test_expect_success 'detect bad hash version' '
499 corrupt_graph_and_verify $GRAPH_BYTE_HASH "\03" \
503 test_expect_success 'detect low chunk count' '
504 corrupt_graph_and_verify $GRAPH_BYTE_CHUNK_COUNT "\02" \
505 "missing the .* chunk"
508 test_expect_success 'detect missing OID fanout chunk' '
509 corrupt_graph_and_verify $GRAPH_BYTE_OID_FANOUT_ID "\0" \
510 "missing the OID Fanout chunk"
513 test_expect_success 'detect missing OID lookup chunk' '
514 corrupt_graph_and_verify $GRAPH_BYTE_OID_LOOKUP_ID "\0" \
515 "missing the OID Lookup chunk"
518 test_expect_success 'detect missing commit data chunk' '
519 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_DATA_ID "\0" \
520 "missing the Commit Data chunk"
523 test_expect_success 'detect incorrect fanout' '
524 corrupt_graph_and_verify $GRAPH_BYTE_FANOUT1 "\01" \
528 test_expect_success 'detect incorrect fanout final value' '
529 corrupt_graph_and_verify $GRAPH_BYTE_FANOUT2 "\01" \
533 test_expect_success 'detect incorrect OID order' '
534 corrupt_graph_and_verify $GRAPH_BYTE_OID_LOOKUP_ORDER "\01" \
535 "incorrect OID order"
538 test_expect_success 'detect OID not in object database' '
539 corrupt_graph_and_verify $GRAPH_BYTE_OID_LOOKUP_MISSING "\01" \
540 "from object database"
543 test_expect_success 'detect incorrect tree OID' '
544 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_TREE "\01" \
545 "root tree OID for commit"
548 test_expect_success 'detect incorrect parent int-id' '
549 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_PARENT "\01" \
553 test_expect_success 'detect extra parent int-id' '
554 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_EXTRA_PARENT "\00" \
558 test_expect_success 'detect wrong parent' '
559 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_WRONG_PARENT "\01" \
560 "commit-graph parent for"
563 test_expect_success 'detect incorrect generation number' '
564 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\070" \
565 "generation for commit"
568 test_expect_success 'detect incorrect generation number' '
569 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_GENERATION "\01" \
570 "non-zero generation number"
573 test_expect_success 'detect incorrect commit date' '
574 corrupt_graph_and_verify $GRAPH_BYTE_COMMIT_DATE "\01" \
578 test_expect_success 'detect incorrect parent for octopus merge' '
579 corrupt_graph_and_verify $GRAPH_BYTE_OCTOPUS "\01" \
583 test_expect_success 'detect invalid checksum hash' '
584 corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \
588 test_expect_success 'detect incorrect chunk count' '
589 corrupt_graph_and_verify $GRAPH_BYTE_CHUNK_COUNT "\377" \
590 "chunk lookup table entry missing" $GRAPH_CHUNK_LOOKUP_OFFSET
593 test_expect_success 'git fsck (checks commit-graph)' '
594 cd "$TRASH_DIRECTORY/full" &&
596 corrupt_graph_and_verify $GRAPH_BYTE_FOOTER "\00" \
597 "incorrect checksum" &&
598 cp commit-graph-pre-write-test $objdir/info/commit-graph &&
599 test_must_fail git fsck
602 test_expect_success 'setup non-the_repository tests' '
605 test_commit -C repo one &&
606 test_commit -C repo two &&
607 git -C repo config core.commitGraph true &&
608 git -C repo rev-parse two | \
609 git -C repo commit-graph write --stdin-commits
612 test_expect_success 'parse_commit_in_graph works for non-the_repository' '
613 test-tool repository parse_commit_in_graph \
614 repo/.git repo "$(git -C repo rev-parse two)" >actual &&
616 git -C repo log --pretty=format:"%ct " -1 &&
617 git -C repo rev-parse one
619 test_cmp expect actual &&
621 test-tool repository parse_commit_in_graph \
622 repo/.git repo "$(git -C repo rev-parse one)" >actual &&
623 git -C repo log --pretty="%ct" -1 one >expect &&
624 test_cmp expect actual
627 test_expect_success 'get_commit_tree_in_graph works for non-the_repository' '
628 test-tool repository get_commit_tree_in_graph \
629 repo/.git repo "$(git -C repo rev-parse two)" >actual &&
630 git -C repo rev-parse two^{tree} >expect &&
631 test_cmp expect actual &&
633 test-tool repository get_commit_tree_in_graph \
634 repo/.git repo "$(git -C repo rev-parse one)" >actual &&
635 git -C repo rev-parse one^{tree} >expect &&
636 test_cmp expect actual
639 test_expect_success 'corrupt commit-graph write (broken parent)' '
644 empty="$(git mktree </dev/null)" &&
645 cat >broken <<-EOF &&
648 author whatever <whatever@example.com> 1234 -0000
649 committer whatever <whatever@example.com> 1234 -0000
653 broken="$(git hash-object -w -t commit --literally broken)" &&
654 git commit-tree -p "$broken" -m "good commit" "$empty" >good &&
655 test_must_fail git commit-graph write --stdin-commits \
657 test_i18ngrep "unable to parse commit" test_err
661 test_expect_success 'corrupt commit-graph write (missing tree)' '
666 tree="$(git mktree </dev/null)" &&
667 cat >broken <<-EOF &&
669 author whatever <whatever@example.com> 1234 -0000
670 committer whatever <whatever@example.com> 1234 -0000
674 broken="$(git hash-object -w -t commit --literally broken)" &&
675 git commit-tree -p "$broken" -m "good" "$tree" >good &&
676 test_must_fail git commit-graph write --stdin-commits \
678 test_i18ngrep "unable to parse commit" test_err