Git development
 help / color / mirror / Atom feed
From: "Jayesh Daga via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Justin Tobler <jltobler@gmail.com>,
	Ayush Chandekar <ayu.chandekar@gmail.com>,
	Siddharth Asthana <siddharthasthana31@gmail.com>,
	Jayesh Daga <jayeshdaga99@gmail.com>,
	Jayesh Daga <jayeshdaga99@gmail.com>
Subject: [PATCH] cache-tree: use index state repository in trace2 calls
Date: Tue, 31 Mar 2026 10:02:53 +0000	[thread overview]
Message-ID: <pull.2259.git.git.1774951373588.gitgitgadget@gmail.com> (raw)

From: Jayesh Daga <jayeshdaga99@gmail.com>

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>
---
    cache-tree: use index state repository in trace2 calls
    
    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' instead in these call sites to ensure correct
    repository attribution.
    
    Signed-off-by: Jayesh Daga jayeshdaga99@gmail.com
    
    cc :Karthik Nayak karthik.188@gmail.com

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2259%2Fjayesh0104%2Fcache-tree-trace2-repo-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2259/jayesh0104/cache-tree-trace2-repo-v1
Pull-Request: https://github.com/git/git/pull/2259

 cache-tree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cache-tree.c b/cache-tree.c
index 60bcc07c3b..e4f9174c4a 100644
--- a/cache-tree.c
+++ b/cache-tree.c
@@ -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;

base-commit: 5361983c075154725be47b65cca9a2421789e410
-- 
gitgitgadget

                 reply	other threads:[~2026-03-31 10:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=pull.2259.git.git.1774951373588.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=ayu.chandekar@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jayeshdaga99@gmail.com \
    --cc=jltobler@gmail.com \
    --cc=siddharthasthana31@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox