Commit 7fdfaae
committed
read-cache: use istate->repo for trace2 logging
trace2_data_intmax() calls in do_read_index() currently use the
global 'the_repository' instance, even though the index_state
already carries an explicit repository pointer (istate->repo).
index_state instances are initialized via INDEX_STATE_INIT(r),
which sets istate->repo. Using the_repository here is therefore
redundant and obscures the actual repository context associated
with the index being read.
In particular, using the global repository can lead to misleading
trace2 output in scenarios where multiple repository instances are
in use (such as tests or future refactoring toward better library
boundaries), as events may be attributed to the wrong repository.
Switch these calls to use istate->repo directly, making the
association between the index and its repository explicit.
Since istate->repo is expected to be non-NULL, enforce this
assumption with a BUG() check so that any violation of this
invariant is caught early.
Also remove the now-obsolete TODO comment.
Signed-off-by: Jayesh Daga <jayeshdaga99@gmail.com>1 parent ca1db8a commit 7fdfaae
1 file changed
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2206 | 2206 | | |
2207 | 2207 | | |
2208 | 2208 | | |
| 2209 | + | |
2209 | 2210 | | |
2210 | 2211 | | |
2211 | 2212 | | |
| |||
2309 | 2310 | | |
2310 | 2311 | | |
2311 | 2312 | | |
2312 | | - | |
2313 | | - | |
2314 | | - | |
2315 | | - | |
2316 | | - | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
2317 | 2317 | | |
2318 | | - | |
| 2318 | + | |
2319 | 2319 | | |
2320 | 2320 | | |
2321 | 2321 | | |
| |||
0 commit comments