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

Re: [PATCH v3] packed-refs: use `fwrite()` when passing refs verbatim

From
Patrick Steinhardt <ps@pks.im>
Date
Oct 7, 2026, 05:12 UTC
Message-ID
<asXUx8DBGNg7ltk1@pks.im>
In-Reply-To
<CAOLa=ZSbT6AHfU178khN7n9rHAmNE5HEM1acr96HXqXpRcSzmg@mail.gmail.com>
On Tue, Oct 06, 2026 at 05:11:57PM -0400, Karthik Nayak wrote:
Show 25 quoted lines
> Patrick Steinhardt <ps@pks.im> writes:
> > On Tue, Oct 06, 2026 at 11:18:40AM +0200, Karthik Nayak wrote:
> >> diff --git a/refs/packed-backend.c b/refs/packed-backend.c
> >> index a73fc6aca7..43ad674cf4 100644
> >> --- a/refs/packed-backend.c
> >> +++ b/refs/packed-backend.c
> >> @@ -879,6 +879,12 @@ struct packed_ref_iterator {
> >>  	/* The current position in the snapshot's buffer: */
> >>  	const char *pos;
> >>
> >> +	/*
> >> +	 * Start of the current record, set when advancing `pos`. Used to
> >> +	 * pass records verbatim to `fwrite()`.
> >> +	 */
> >> +	const char *record_start;
> >
> > The way this is written makes you think that `pos == record_start`, and
> > thus one wonders why we even need this separate variable in the first
> > place. So I assume that we modify `pos` in some cases without modifying
> > the new variable at the same point in time. But if so, the above comment
> > is not true anymore.
> >
> 
> Hmm. I only state that this is 'set _when_ advancing `pos`', Why do you
> think that this would mean `pos == record_start`?

To me it reads as "whenever we advance `pos`, then we set `record_start`". Which is not the case, we also sometimes advance `pos` without setting it.

Patrick
Previous: Karthik NayakNext: Karthik Nayak
Message 10 of 16 in “packed-refs: use `fwrite()` when passing refs verbatim”
  1. packed-refs: use `fwrite()` when passing refs verbatimKarthik Nayak, Sep 30, 2026
  2. Toon ClaesOct 1, 2026
  3. Karthik NayakOct 2, 2026
  4. packed-refs: use `fwrite()` when passing refs verbatimKarthik Nayak, Oct 2, 2026
  5. Toon ClaesOct 5, 2026
  6. Karthik NayakOct 6, 2026
  7. packed-refs: use `fwrite()` when passing refs verbatimKarthik Nayak, Oct 6, 2026
  8. Patrick SteinhardtOct 6, 2026
  9. Karthik NayakOct 6, 2026
  10. Patrick SteinhardtOct 7, 2026
  11. Karthik NayakOct 7, 2026
  12. Junio C HamanoOct 6, 2026
  13. Karthik NayakOct 6, 2026
  14. packed-refs: use `fwrite()` when passing refs verbatimKarthik Nayak, Oct 7, 2026
  15. Patrick SteinhardtOct 7, 2026
  16. Toon ClaesOct 8, 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.