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

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.

Previous: Ben KnobleNext: Junio C Hamano
Message 4 of 6 in “git stash drop stash@{2.days.ago}”
  1. 0/2 git stash drop stash@{2.days.ago}Junio C Hamano, Jul 30, 2026
  2. 1/2 stash: record positional index in 'struct stash_info'Junio C Hamano, Jul 30, 2026
  3. Ben KnobleJul 30, 2026
  4. Junio C HamanoJul 30, 2026
  5. 2/2 stash: reject time-based selectors in drop and popJunio C Hamano, Jul 30, 2026
  6. Junio C HamanoJul 30, 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.