Skip to content

Commit 4cc0f8e

Browse files
committed
Merge branch 'jk/commit-graph-slab-clear-fix'
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 b27f67a + d70f554 commit 4cc0f8e

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
@@ -806,6 +806,9 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
806806

807807
void close_commit_graph(struct raw_object_store *o)
808808
{
809+
if (!o->commit_graph)
810+
return;
811+
809812
clear_commit_graph_data_slab(&commit_graph_data_slab);
810813
free_commit_graph(o->commit_graph);
811814
o->commit_graph = NULL;

t/t5510-fetch.sh

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

0 commit comments

Comments
 (0)