3 test_description
='commit graph with 64-bit timestamps'
5 TEST_PASSES_SANITIZE_LEAK
=true
8 if ! test_have_prereq TIME_IS_64BIT ||
! test_have_prereq TIME_T_IS_64BIT
10 skip_all
='skipping 64-bit timestamp tests'
14 .
"$TEST_DIRECTORY"/lib-commit-graph.sh
15 .
"$TEST_DIRECTORY/lib-chunk.sh"
17 UNIX_EPOCH_ZERO
="@0 +0000"
18 FUTURE_DATE
="@4147483646 +0000"
20 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS
=0
22 test_expect_success
'lower layers have overflow chunk' '
23 rm -f .git/objects/info/commit-graph &&
24 test_commit --date "$FUTURE_DATE" future-1 &&
25 test_commit --date "$UNIX_EPOCH_ZERO" old-1 &&
26 git commit-graph write --reachable &&
27 test_commit --date "$FUTURE_DATE" future-2 &&
28 test_commit --date "$UNIX_EPOCH_ZERO" old-2 &&
29 git commit-graph write --reachable --split=no-merge &&
31 git commit-graph write --reachable --split=no-merge &&
32 git commit-graph write --reachable &&
33 graph_read_expect 5 "generation_data generation_data_overflow" &&
34 mv .git/objects/info/commit-graph commit-graph-upgraded &&
35 git commit-graph write --reachable &&
36 graph_read_expect 5 "generation_data generation_data_overflow" &&
37 test_cmp .git/objects/info/commit-graph commit-graph-upgraded
40 graph_git_behavior
'overflow' '' HEAD~
2 HEAD
42 test_expect_success
'set up and verify repo with generation data overflow chunk' '
46 test_commit --date "$UNIX_EPOCH_ZERO" 1 &&
48 test_commit --date "$UNIX_EPOCH_ZERO" 3 &&
49 git commit-graph write --reachable &&
50 graph_read_expect 3 generation_data &&
51 test_commit --date "$FUTURE_DATE" 4 &&
53 test_commit --date "$UNIX_EPOCH_ZERO" 6 &&
57 test_commit --date "$FUTURE_DATE" 8 &&
61 test_merge M left right &&
62 git commit-graph write --reachable &&
63 graph_read_expect 10 "generation_data generation_data_overflow" &&
64 git commit-graph verify
68 graph_git_behavior
'overflow 2' repo left right
70 test_expect_success
'single commit with generation data exceeding UINT32_MAX' '
71 git init repo-uint32-max &&
72 test_commit -C repo-uint32-max --date "@4294967297 +0000" 1 &&
73 git -C repo-uint32-max commit-graph write --reachable &&
74 graph_read_expect -C repo-uint32-max 1 "generation_data" &&
75 git -C repo-uint32-max commit-graph verify
78 test_expect_success
'reader notices out-of-bounds generation overflow' '
79 graph=.git/objects/info/commit-graph &&
80 test_when_finished "rm -rf $graph" &&
81 git commit-graph write --reachable &&
82 corrupt_chunk_file $graph GDO2 clear &&
83 test_must_fail git log 2>err &&
84 grep "commit-graph overflow generation data is too small" err