1
0
mirror of https://github.com/git/git synced 2024-07-05 00:58:49 +00:00

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
This commit is contained in:
Junio C Hamano 2024-01-16 10:11:58 -08:00
commit 4cc0f8e8fa
2 changed files with 5 additions and 1 deletions

View File

@ -806,6 +806,9 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
void close_commit_graph(struct raw_object_store *o)
{
if (!o->commit_graph)
return;
clear_commit_graph_data_slab(&commit_graph_data_slab);
free_commit_graph(o->commit_graph);
o->commit_graph = NULL;

View File

@ -803,7 +803,8 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
cd super-clone &&
rm -rf .git/objects/info &&
git -c fetch.writeCommitGraph=true fetch origin &&
test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain
test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain &&
git -c fetch.writeCommitGraph=true fetch --recurse-submodules origin
)
'