aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2026-04-07 14:59:25 -0700
committerJunio C Hamano <gitster@pobox.com>2026-04-07 14:59:25 -0700
commitd88c8ba70bbcbc45a31cf05034a8e0c6884fb3d3 (patch)
treedb7f8cc1f8de8bf1e6a915561e072c4bbbec15a7 /t
parent716b9db0d3e1662fe2b84582a8b84ee3ff9f867d (diff)
parent04c9c5e8d2d99050d260149cad9dde1302a02ff4 (diff)
downloadgit-d88c8ba70bbcbc45a31cf05034a8e0c6884fb3d3.tar.xz
Merge branch 'ps/commit-graph-overflow-fix'
Fix a regression in writing the commit-graph where commits with dates exceeding 34 bits (beyond year 2514) could cause an underflow and crash Git during the generation data overflow chunk writing. * ps/commit-graph-overflow-fix: commit-graph: fix writing generations with dates exceeding 34 bits
Diffstat (limited to 't')
-rwxr-xr-xt/t5318-commit-graph.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh
index 98c6910963..1c40f904f8 100755
--- a/t/t5318-commit-graph.sh
+++ b/t/t5318-commit-graph.sh
@@ -417,6 +417,26 @@ test_expect_success TIME_IS_64BIT,TIME_T_IS_64BIT 'lower layers have overflow ch
test_cmp full/.git/objects/info/commit-graph commit-graph-upgraded
'
+test_expect_success TIME_IS_64BIT,TIME_T_IS_64BIT 'overflow chunk when replacing commit-graph' '
+ test_when_finished "rm -rf repo" &&
+ git init repo &&
+ (
+ cd repo &&
+ cat >commit <<-EOF &&
+ tree $(test_oid empty_tree)
+ author Example <committer@example.com> 9223372036854775 +0000
+ committer Example <committer@example.com> 9223372036854775 +0000
+
+ Weird commit date
+ EOF
+ commit_id=$(git hash-object -t commit -w commit) &&
+ git reset --hard "$commit_id" &&
+ git commit-graph write --reachable &&
+ git commit-graph write --reachable --split=replace &&
+ git log
+ )
+'
+
# the verify tests below expect the commit-graph to contain
# exactly the commits reachable from the commits/8 branch.
# If the file changes the set of commits in the list, then the