All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, toon@iotcl.com
Subject: Re: [PATCH v3] packed-refs: use `fwrite()` when passing refs verbatim
Date: Wed, 7 Oct 2026 07:12:39 +0200	[thread overview]
Message-ID: <asXUx8DBGNg7ltk1@pks.im> (raw)
In-Reply-To: <CAOLa=ZSbT6AHfU178khN7n9rHAmNE5HEM1acr96HXqXpRcSzmg@mail.gmail.com>

On Tue, Oct 06, 2026 at 05:11:57PM -0400, Karthik Nayak wrote:
> 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

  reply	other threads:[~2026-10-07  5:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-30 15:15 [PATCH] packed-refs: use `fwrite()` when passing refs verbatim Karthik Nayak
2026-10-01 20:30 ` Toon Claes
2026-10-02  0:16   ` Karthik Nayak
2026-10-02 13:03 ` [PATCH v2] " Karthik Nayak
2026-10-05 18:34   ` Toon Claes
2026-10-06  9:36     ` Karthik Nayak
2026-10-06  9:18 ` [PATCH v3] " Karthik Nayak
2026-10-06 12:31   ` Patrick Steinhardt
2026-10-06 21:11     ` Karthik Nayak
2026-10-07  5:12       ` Patrick Steinhardt [this message]
2026-10-07  9:25         ` Karthik Nayak
2026-10-06 16:19   ` Junio C Hamano
2026-10-06 20:59     ` Karthik Nayak
2026-10-07 11:20 ` [PATCH v4] " Karthik Nayak
2026-10-07 11:52   ` Patrick Steinhardt
2026-10-08 11:41     ` Toon Claes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=asXUx8DBGNg7ltk1@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=karthik.188@gmail.com \
    --cc=toon@iotcl.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.