summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-08-03 20:36:08 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-08-03 20:36:08 (GMT)
commit37e4bdd5ee5d6a7e09feaf5857299aac8fd56aeb (patch)
tree68792e9cddee8c9d9a738e2547546c7a311aa4ce /t
parentf1a0db23ad269d46ae43fd34d04ab6065081a92f (diff)
parent9550f6c16a8be18bd4868909d4d5e29d05bd9733 (diff)
downloadgit-37e4bdd5ee5d6a7e09feaf5857299aac8fd56aeb.zip
git-37e4bdd5ee5d6a7e09feaf5857299aac8fd56aeb.tar.gz
git-37e4bdd5ee5d6a7e09feaf5857299aac8fd56aeb.tar.bz2
Merge branch 'tb/commit-graph-genv2-upgrade-fix'
There was a bug in the codepath to upgrade generation information in commit-graph from v1 to v2 format, which has been corrected. * tb/commit-graph-genv2-upgrade-fix: commit-graph: fix corrupt upgrade from generation v1 to v2 commit-graph: introduce `repo_find_commit_pos_in_graph()` t5318: demonstrate commit-graph generation v2 corruption
Diffstat (limited to 't')
-rwxr-xr-xt/t5318-commit-graph.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index be0b564..1b0cd82 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -812,4 +812,31 @@ test_expect_success 'set up and verify repo with generation data overflow chunk'
graph_git_behavior 'generation data overflow chunk repo' repo left right
+test_expect_success 'overflow during generation version upgrade' '
+ git init overflow-v2-upgrade &&
+ (
+ cd overflow-v2-upgrade &&
+
+ # This commit will have a date at two seconds past the Epoch,
+ # and a (v1) generation number of 1, since it is a root commit.
+ #
+ # The offset will then be computed as 1-2, which will underflow
+ # to 2^31, which is greater than the v2 offset small limit of
+ # 2^31-1.
+ #
+ # This is sufficient to need a large offset table for the v2
+ # generation numbers.
+ test_commit --date "@2 +0000" base &&
+ git repack -d &&
+
+ # Test that upgrading from generation v1 to v2 correctly
+ # produces the overflow table.
+ git -c commitGraph.generationVersion=1 commit-graph write &&
+ git -c commitGraph.generationVersion=2 commit-graph write \
+ --changed-paths &&
+
+ git rev-list --all
+ )
+'
+
test_done