Skip to content

unpack-trees: use explicit repository in trace2 calls

Jayesh Daga via GitGitGadget git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesIn review
  2. v11 patch 3 repliesSuperseded

Changes in v2 from the cover letter

* Use repository from src_index instead of the_repository
* Address review feedback from Patrick Steinhardt
* Avoid introducing new API or struct fields

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2unpack-trees: use repository from index instead of globalunpack-trees.c+6 -60 replies
2/2unpack-trees: use repository from index instead of globalunpack-trees.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/2] 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.

v2:

* Use repository from src_index instead of the_repository
* Address review feedback from Patrick Steinhardt
* Avoid introducing new API or struct fields

cc Karthik Nayak [email protected]

Jayesh Daga (2):
unpack-trees: use repository from index instead of global
unpack-trees: use repository from index instead of global

 unpack-trees.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

base-commit: 5361983c075154725be47b65cca9a2421789e410
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2258%2Fjayesh0104%2Funpack-trees-trace2-repo-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2258/jayesh0104/unpack-trees-trace2-repo-v2
Pull-Request: https://github.com/git/git/pull/2258

Range-diff vs v1:

1: 717da16044 ! 1: f03ea194e3 unpack-trees: use explicit repository in trace2 calls
@@ Metadata
Author: Jayesh Daga <[email protected]>

## Commit message ##
- unpack-trees: use explicit repository in trace2 calls
+ unpack-trees: use repository from index instead of global

- 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.
+ unpack_trees() currently initializes its repository from the
+ global 'the_repository', even though a repository instance is
+ already available via the source index.

- 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 'o->src_index->repo' instead of the global variable,
+ reducing reliance on global repository state.

- Use explicit repository pointers instead to ensure correct
- repository attribution.
+ This is a step towards eliminating global repository usage in
+ unpack_trees().

+ Suggested-by: Patrick Steinhardt <[email protected]>

## unpack-trees.c ##
-: ---------- > 2: fbdf3271b7 unpack-trees: use repository from index instead of global

Signature · 1 line
gitgitgadget