Skip to content

Commit 1685e9f

Browse files
committed
Merge branch 'jk/commit-graph-slab-clear-fix' into maint-2.43
Clearing in-core repository (happens during e.g., "git fetch --recurse-submodules" with commit graph enabled) made in-core commit object in an inconsistent state by discarding the necessary data from commit-graph too early, which has been corrected. * jk/commit-graph-slab-clear-fix: commit-graph: retain commit slab when closing NULL commit_graph
2 parents 3c2ee13 + d70f554 commit 1685e9f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

commit-graph.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,9 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
831831

832832
void close_commit_graph(struct raw_object_store *o)
833833
{
834+
if (!o->commit_graph)
835+
return;
836+
834837
clear_commit_graph_data_slab(&commit_graph_data_slab);
835838
free_commit_graph(o->commit_graph);
836839
o->commit_graph = NULL;

t/t5510-fetch.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,8 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
802802
cd super-clone &&
803803
rm -rf .git/objects/info &&
804804
git -c fetch.writeCommitGraph=true fetch origin &&
805-
test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain
805+
test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain &&
806+
git -c fetch.writeCommitGraph=true fetch --recurse-submodules origin
806807
)
807808
'
808809

0 commit comments

Comments
 (0)