]> git.ipfire.org Git - thirdparty/git.git/commitdiff
cache-tree: use index state repository in trace2 calls
authorJayesh Daga <jayeshdaga99@gmail.com>
Tue, 31 Mar 2026 10:02:53 +0000 (10:02 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 31 Mar 2026 16:39:03 +0000 (09:39 -0700)
trace2 calls in cache-tree.c use the global 'the_repository',
even though cache_tree_update() has access to an explicit
repository pointer via 'istate->repo'.

Using the global repository can result in incorrect trace2
output when multiple repository instances are in use, as
events may be attributed to the wrong repository.

Use 'istate->repo' in cache_tree_update() to ensure correct
repository attribution.

Other call sites are left unchanged as they do not have
access to a repository instance.

Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cache-tree.c

index 60bcc07c3b83579688c01e35c7b35b42902d597e..e4f9174c4a35cf86055fc8037c51c18b748ccb68 100644 (file)
@@ -488,12 +488,12 @@ int cache_tree_update(struct index_state *istate, int flags)
                prefetch_cache_entries(istate, must_check_existence);
 
        trace_performance_enter();
-       trace2_region_enter("cache_tree", "update", the_repository);
+       trace2_region_enter("cache_tree", "update", istate->repo);
        transaction = odb_transaction_begin(the_repository->objects);
        i = update_one(istate->cache_tree, istate->cache, istate->cache_nr,
                       "", 0, &skip, flags);
        odb_transaction_commit(transaction);
-       trace2_region_leave("cache_tree", "update", the_repository);
+       trace2_region_leave("cache_tree", "update", istate->repo);
        trace_performance_leave("cache_tree_update");
        if (i < 0)
                return i;