Re: [PATCH 1/2] stash: record positional index in 'struct stash_info'
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 30, 2026, 13:22 UTC
- Message-ID
- <87h5lgtxw4.fsf@gitster.g>
- In-Reply-To
- <AA402B97-B3DC-4085-AF53-C6D80792C3DF@gmail.com>
Ben Knoble <ben.knoble@gmail.com> writes:
Show 6 quoted lines
>> + if (at) {
>> + char *ep;
>> + unsigned long u = strtoul(at + 2, &ep, 10);
>> + if (ep > at + 2 && *ep == '}' && u < 100000000)
>> + info->stash_idx = (int)u;
>Show 6 quoted lines
> What’s the purpose of the 1e8 constant/comparison? I see we
> truncate the unsigned long to an int, but even on 32-bit platforms
> 1e8 is a small portion of the integer range, right? So my read is
> that we are limiting the valid « n » in @{n}. I’m not totally
> sure why, though, or if that matches with the rest of the stash
> manipulation code.This mirrors what approxidate does. An integer that is too big is taken as number-of-seconds-since-epoch.