git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] read-cache: use index state repository for trace2 logging

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 27, 2026, 16:28 UTC
Message-ID
<xmqqqzp5kzj3.fsf@gitster.g>
In-Reply-To
<770465fe-c38f-45a9-b1b0-0ad682a35fab@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 8 quoted lines
> On 3/27/2026 6:08 AM, Jayesh Daga via GitGitGadget wrote:
>
>>     Robustness: The ternary fallback ensures we avoid potential NULL pointer
>>     dereferences while maintaining existing logging behavior in edge cases.
>
>> +	r = istate->repo ? istate->repo : the_repository;
>
> If I understand correctly, it is a bug if istate->repo is NULL.

Because INDEX_STATE_INIT(r) assigns the repository as the first thing, I tend to agree. A (bare) repository can lack the index so repo->index might be NULL, but if you have an istate instance, it should always know which repository it came from.

Show 8 quoted lines
>> +	trace2_data_intmax("index", r, "read/version",
>>  			   istate->version);
>> -	trace2_data_intmax("index", the_repository, "read/cache_nr",
>> +	trace2_data_intmax("index", r, "read/cache_nr",
>>  			   istate->cache_nr);
>
> Other than that, this is a minor improvement in the right direction. I'd
> rather that it be more complete if you are working in this file.
;-)  Long timers always aim higher than posted patches.
Show 9 quoted lines
> If you are already working in this space, then I recommend figuring out
> how much we can rely on istate->repo and then apply that knowledge to
> these cases as separate commits:
>
> 1. Replace the uses in the trace2 calls with istate->repo
>    and delete the TODO comments.
>
> 2. Replace the other uses of the_repository when an istate
>    exists already.

Excellent suggestion. Thanks.

By the way, Jeyesh, do you really want to be known with a numbered "jayesh0104" as your name? These author identities are cast in stone in commit objects and will stay with the project.

Also see Documentation/SubmittingPatches::[dco,real-name].
Previous: Derrick StoleeNext: jayesh0104
Message 3 of 14 in “read-cache: use index state repository for trace2 logging”
  1. read-cache: use index state repository for trace2 loggingJayesh Daga via GitGitGadget, Mar 27, 2026
  2. Derrick StoleeMar 27, 2026
  3. Junio C HamanoMar 27, 2026
  4. jayesh0104Mar 28, 2026
  5. read-cache: use istate->repo for trace2 loggingJayesh Daga via GitGitGadget, Mar 28, 2026
  6. Junio C HamanoMar 28, 2026
  7. Derrick StoleeMar 29, 2026
  8. 0/2 [GSoC] read-cache: use index state repository for trace2 loggingJayesh Daga via GitGitGadget, Mar 30, 2026
  9. 1/2 repo: add paths.git_dir repo info keyjayesh0104 via GitGitGadget, Mar 30, 2026
  10. 2/2 read-cache: use istate->repo for trace2 loggingJayesh Daga via GitGitGadget, Mar 30, 2026
  11. read-cache: use istate->repo for trace2 loggingJayesh Daga via GitGitGadget, Mar 30, 2026
  12. Junio C HamanoMar 30, 2026
  13. Derrick StoleeApr 2, 2026
  14. Jayesh DagaApr 2, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.