Skip to content

Commit ba6d2ad

Browse files
committed
read-cache: use index state repository for trace2 logging
Replace uses of the_repository in trace2_data_intmax() with istate->repo, which represents the repository associated with the index state. This avoids relying on global repository state and aligns with other parts of the codebase (e.g., sparse-index.c) that pass the repository instance explicitly. No functional change intended. Signed-off-by: jayesh0104 <jayeshdaga99@gmail.com>
1 parent ca1db8a commit ba6d2ad

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

read-cache.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,6 +2206,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
22062206
size_t extension_offset = 0;
22072207
int nr_threads, cpus;
22082208
struct index_entry_offset_table *ieot = NULL;
2209+
struct repository *r;
22092210

22102211
if (istate->initialized)
22112212
return istate->cache_nr;
@@ -2313,9 +2314,10 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
23132314
* TODO trace2: replace "the_repository" with the actual repo instance
23142315
* that is associated with the given "istate".
23152316
*/
2316-
trace2_data_intmax("index", the_repository, "read/version",
2317+
r = istate->repo ? istate->repo : the_repository;
2318+
trace2_data_intmax("index", r, "read/version",
23172319
istate->version);
2318-
trace2_data_intmax("index", the_repository, "read/cache_nr",
2320+
trace2_data_intmax("index", r, "read/cache_nr",
23192321
istate->cache_nr);
23202322

23212323
/*

0 commit comments

Comments
 (0)