Merge branch 'tb/commit-graph-genv2-upgrade-fix' into maint
There was a bug in the codepath to upgrade generation information in commit-graph from v1 to v2 format, which has been corrected. source: <cover.1657667404.git.me@ttaylorr.com> * 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
This commit is contained in:
@ -811,4 +811,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
|
||||
|
Reference in New Issue
Block a user