Re: [PATCH v2 7/8] packed-backend: check whether the "packed-refs" is sorted
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 30, 2025, 19:02 UTC
- Message-ID
- <xmqqwmecceh1.fsf@gitster.g>
- In-Reply-To
- <Z5r7KvL1bvSO4UQY@ArchLinux>
shejialuo <shejialuo@gmail.com> writes:
> We will always try to sort the "packed-refs" increasingly by comparing > the refname. So, we should add checks to verify whether the "packed-refs" > is sorted.
Do this _ONLY_ when the packed-refs file has a header that declares "sorted" trait. Insisting on a packed-refs file that does not would mean you are stricter than the runtime contract allows.
Show 5 quoted lines
> +struct fsck_packed_ref_entry {
> + int line_number;
> +
> + struct snapshot_record record;
> +};Not a huge deal, as 1 billion is still plenty of a large number, but the same comment on the line-number applies here. We might want to consistently use ulong for line numbers of files we read from.