Skip to content

Commit 119e82a

Browse files
committed
Merge branch 'ps/ahead-behind-truncation-fix'
Fix unnecessary truncation of generation numbers used in-core. * ps/ahead-behind-truncation-fix: commit-graph: fix truncated generation numbers
2 parents 7727da9 + d3af1c1 commit 119e82a

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

commit-graph.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ static timestamp_t get_generation_from_graph_data(struct commit *c, void *data)
15661566
static void set_generation_v2(struct commit *c, timestamp_t t, void *data)
15671567
{
15681568
struct commit_graph_data *g = commit_graph_data_at(c);
1569-
g->generation = (uint32_t)t;
1569+
g->generation = t;
15701570
}
15711571

15721572
static void compute_generation_numbers(struct write_commit_graph_context *ctx)

t/t5328-commit-graph-64bit-time.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,13 @@ test_expect_success 'set up and verify repo with generation data overflow chunk'
6363

6464
graph_git_behavior 'overflow 2' repo left right
6565

66+
test_expect_success 'single commit with generation data exceeding UINT32_MAX' '
67+
git init repo-uint32-max &&
68+
cd repo-uint32-max &&
69+
test_commit --date "@4294967297 +0000" 1 &&
70+
git commit-graph write --reachable &&
71+
graph_read_expect 1 "generation_data" &&
72+
git commit-graph verify
73+
'
74+
6675
test_done

0 commit comments

Comments
 (0)