Git development
 help / color / mirror / Atom feed
* [PATCH] unpack-trees: use explicit repository in trace2 calls
@ 2026-03-30 20:13 Jayesh Daga via GitGitGadget
  2026-03-31  5:31 ` Patrick Steinhardt
  2026-03-31 15:34 ` [PATCH v2 0/2] " Jayesh Daga via GitGitGadget
  0 siblings, 2 replies; 8+ messages in thread
From: Jayesh Daga via GitGitGadget @ 2026-03-30 20:13 UTC (permalink / raw)
  To: git
  Cc: Justin Tobler, Ayush Chandekar, Siddharth Asthana, Jayesh Daga,
	Jayesh Daga

From: Jayesh Daga <jayeshdaga99@gmail.com>

trace2 calls in unpack-trees.c use the global 'the_repository',
even though the relevant context provides an explicit repository
pointer via 'istate->repo' or the local 'repo' variable.

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 explicit repository pointers instead to ensure correct
repository attribution.

Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>
---
    unpack-trees: use explicit repository in trace2 calls
    
    trace2 calls in unpack-trees.c use the global 'the_repository', even
    though the relevant context provides an explicit repository pointer via
    'istate->repo' or the local 'repo' variable.
    
    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 explicit repository pointers 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-2258%2Fjayesh0104%2Funpack-trees-trace2-repo-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2258/jayesh0104/unpack-trees-trace2-repo-v1
Pull-Request: https://github.com/git/git/pull/2258

 unpack-trees.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 998a1e6dc7..191b9d4769 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -1780,14 +1780,14 @@ static int clear_ce_flags(struct index_state *istate,
 
 	xsnprintf(label, sizeof(label), "clear_ce_flags(0x%08lx,0x%08lx)",
 		  (unsigned long)select_mask, (unsigned long)clear_mask);
-	trace2_region_enter("unpack_trees", label, the_repository);
+	trace2_region_enter("unpack_trees", label, istate->repo);
 	rval = clear_ce_flags_1(istate,
 				istate->cache,
 				istate->cache_nr,
 				&prefix,
 				select_mask, clear_mask,
 				pl, 0, 0);
-	trace2_region_leave("unpack_trees", label, the_repository);
+	trace2_region_leave("unpack_trees", label, istate->repo);
 
 	stop_progress(&istate->progress);
 	return rval;
@@ -1903,7 +1903,7 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 		BUG("o->df_conflict_entry is an output only field");
 
 	trace_performance_enter();
-	trace2_region_enter("unpack_trees", "unpack_trees", the_repository);
+	trace2_region_enter("unpack_trees", "unpack_trees", repo);
 
 	prepare_repo_settings(repo);
 	if (repo->settings.command_requires_full_index) {
@@ -2007,9 +2007,9 @@ int unpack_trees(unsigned len, struct tree_desc *t, struct unpack_trees_options
 		}
 
 		trace_performance_enter();
-		trace2_region_enter("unpack_trees", "traverse_trees", the_repository);
+		trace2_region_enter("unpack_trees", "traverse_trees", repo);
 		ret = traverse_trees(o->src_index, len, t, &info);
-		trace2_region_leave("unpack_trees", "traverse_trees", the_repository);
+		trace2_region_leave("unpack_trees", "traverse_trees", repo);
 		trace_performance_leave("traverse_trees");
 		if (ret < 0)
 			goto return_failed;
@@ -2106,7 +2106,7 @@ done:
 		dir_clear(o->internal.dir);
 		o->internal.dir = NULL;
 	}
-	trace2_region_leave("unpack_trees", "unpack_trees", the_repository);
+	trace2_region_leave("unpack_trees", "unpack_trees", repo);
 	trace_performance_leave("unpack_trees");
 	return ret;
 

base-commit: 5361983c075154725be47b65cca9a2421789e410
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-03-31 21:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 20:13 [PATCH] unpack-trees: use explicit repository in trace2 calls Jayesh Daga via GitGitGadget
2026-03-31  5:31 ` Patrick Steinhardt
2026-03-31 15:32   ` Junio C Hamano
2026-03-31 20:27     ` Junio C Hamano
2026-03-31 15:34 ` [PATCH v2 0/2] " Jayesh Daga via GitGitGadget
2026-03-31 15:34   ` [PATCH v2 1/2] unpack-trees: use repository from index instead of global Jayesh Daga via GitGitGadget
2026-03-31 15:34   ` [PATCH v2 2/2] " Jayesh Daga via GitGitGadget
2026-03-31 21:35   ` [PATCH v2 0/2] unpack-trees: use explicit repository in trace2 calls Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox