public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Taylor Blau <me@ttaylorr•com>
Cc: git@vger•kernel.org,  Jeff King <peff@peff•net>
Subject: Re: [PATCH 2/2] Documentation/gitformat-pack.txt: fix incorrect MIDX documentation
Date: Tue, 31 Oct 2023 09:42:41 +0900	[thread overview]
Message-ID: <xmqq8r7j7hby.fsf@gitster.g> (raw)
In-Reply-To: <ZUAmWWh1WHujiN05@nand.local> (Taylor Blau's message of "Mon, 30 Oct 2023 17:55:37 -0400")

Taylor Blau <me@ttaylorr•com> writes:

>> >  	    Packfiles must be listed in lexicographic order for fast lookups by
>> > -	    name. This is the only chunk not guaranteed to be a multiple of four
>> > -	    bytes in length, so should be the last chunk for alignment reasons.
>> > +	    name. Individual entries in this chunk are not guarenteed to be
>> > +	    aligned. The chunk is externally padded with zeros to align
>> > +	    remaining chunks.
>>
>> I am not sure what "externally padded" means.
>
> How about something like this, instead?
>
> --- 8< ---
> diff --git a/Documentation/gitformat-pack.txt b/Documentation/gitformat-pack.txt
> index 0bc80f0d46..229490f82f 100644
> --- a/Documentation/gitformat-pack.txt
> +++ b/Documentation/gitformat-pack.txt
> @@ -392,9 +392,10 @@ CHUNK DATA:
>  	Packfile Names (ID: {'P', 'N', 'A', 'M'})
>  	    Stores the packfile names as concatenated, NUL-terminated strings.
>  	    Packfiles must be listed in lexicographic order for fast lookups by
> -	    name. Individual entries in this chunk are not guarenteed to be
> -	    aligned. The chunk is externally padded with zeros to align
> -	    remaining chunks.
> +	    name. Individual entries in this chunk are not guaranteed to be
> +	    aligned, since the packfile names can be of arbitrary length. The
> +	    chunk itself is padded at the end with NUL bytes in order to align
> +	    the remaining chunks.

There is no alignment requirement described, so "not guaranteed" and
"in order to align" sound hollow.  These are always byte-aligned ;-)

How about something along this line to simplify it a bit?

	Store the names of packfiles as a sequence of NUL-terminated
	strings.  There is no extra padding between the filenames,
	and they are listed in lexicographic order.  The chunk
	itself is padded at the end with NUL bytes to make the chunk
	size a multiple of 4 bytes.

I did not ccheck if the chunks need to be 4-byte aligned, so if the
number is wrong, please adjust accordingly.


  reply	other threads:[~2023-10-31  0:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-12 21:09 [PATCH 0/2] Documentation/gitformat-pack.txt: correct a few issues/typos Taylor Blau
2023-10-12 21:09 ` [PATCH 1/2] Documentation/gitformat-pack.txt: fix typo Taylor Blau
2023-10-12 21:09 ` [PATCH 2/2] Documentation/gitformat-pack.txt: fix incorrect MIDX documentation Taylor Blau
2023-10-12 21:54   ` Junio C Hamano
2023-10-30 21:55     ` Taylor Blau
2023-10-31  0:42       ` Junio C Hamano [this message]
2023-10-31 19:24 ` [PATCH v2 0/2] Documentation/gitformat-pack.txt: correct a few issues/typos Taylor Blau
2023-10-31 19:24   ` [PATCH v2 1/2] Documentation/gitformat-pack.txt: fix typo Taylor Blau
2023-10-31 19:24   ` [PATCH v2 2/2] Documentation/gitformat-pack.txt: fix incorrect MIDX documentation Taylor Blau
2023-10-31 20:00     ` Jeff King

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=xmqq8r7j7hby.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=me@ttaylorr$(echo .)com \
    --cc=peff@peff$(echo .)net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox