Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'
[alt-git.git] / t / t5328-commit-graph-64bit-time.sh
blob093f0c067af6801e3334152fe65b7c4495830d30
1 #!/bin/sh
3 test_description='commit graph with 64-bit timestamps'
4 . ./test-lib.sh
6 if ! test_have_prereq TIME_IS_64BIT || ! test_have_prereq TIME_T_IS_64BIT
7 then
8 skip_all='skipping 64-bit timestamp tests'
9 test_done
12 . "$TEST_DIRECTORY"/lib-commit-graph.sh
14 UNIX_EPOCH_ZERO="@0 +0000"
15 FUTURE_DATE="@4147483646 +0000"
17 GIT_TEST_COMMIT_GRAPH_CHANGED_PATHS=0
19 test_expect_success 'lower layers have overflow chunk' '
20 rm -f .git/objects/info/commit-graph &&
21 test_commit --date "$FUTURE_DATE" future-1 &&
22 test_commit --date "$UNIX_EPOCH_ZERO" old-1 &&
23 git commit-graph write --reachable &&
24 test_commit --date "$FUTURE_DATE" future-2 &&
25 test_commit --date "$UNIX_EPOCH_ZERO" old-2 &&
26 git commit-graph write --reachable --split=no-merge &&
27 test_commit extra &&
28 git commit-graph write --reachable --split=no-merge &&
29 git commit-graph write --reachable &&
30 graph_read_expect 5 "generation_data generation_data_overflow" &&
31 mv .git/objects/info/commit-graph commit-graph-upgraded &&
32 git commit-graph write --reachable &&
33 graph_read_expect 5 "generation_data generation_data_overflow" &&
34 test_cmp .git/objects/info/commit-graph commit-graph-upgraded
37 graph_git_behavior 'overflow' '' HEAD~2 HEAD
39 test_expect_success 'set up and verify repo with generation data overflow chunk' '
40 mkdir repo &&
41 cd repo &&
42 git init &&
43 test_commit --date "$UNIX_EPOCH_ZERO" 1 &&
44 test_commit 2 &&
45 test_commit --date "$UNIX_EPOCH_ZERO" 3 &&
46 git commit-graph write --reachable &&
47 graph_read_expect 3 generation_data &&
48 test_commit --date "$FUTURE_DATE" 4 &&
49 test_commit 5 &&
50 test_commit --date "$UNIX_EPOCH_ZERO" 6 &&
51 git branch left &&
52 git reset --hard 3 &&
53 test_commit 7 &&
54 test_commit --date "$FUTURE_DATE" 8 &&
55 test_commit 9 &&
56 git branch right &&
57 git reset --hard 3 &&
58 test_merge M left right &&
59 git commit-graph write --reachable &&
60 graph_read_expect 10 "generation_data generation_data_overflow" &&
61 git commit-graph verify
64 graph_git_behavior 'overflow 2' repo left right
66 test_done