All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/2] stash: record positional index in 'struct stash_info'
Date: Thu, 30 Jul 2026 06:22:51 -0700	[thread overview]
Message-ID: <87h5lgtxw4.fsf@gitster.g> (raw)
In-Reply-To: <AA402B97-B3DC-4085-AF53-C6D80792C3DF@gmail.com> (Ben Knoble's message of "Thu, 30 Jul 2026 16:43:07 +0900")

Ben Knoble <ben.knoble@gmail.com> writes:

>> +    if (at) {
>> +        char *ep;
>> +        unsigned long u = strtoul(at + 2, &ep, 10);
>> +        if (ep > at + 2 && *ep == '}' && u < 100000000)
>> +            info->stash_idx = (int)u;
>

> 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.


  reply	other threads:[~2026-07-30 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  3:41 [PATCH 0/2] git stash drop stash@{2.days.ago} Junio C Hamano
2026-07-30  3:41 ` [PATCH 1/2] stash: record positional index in 'struct stash_info' Junio C Hamano
2026-07-30  7:43   ` Ben Knoble
2026-07-30 13:22     ` Junio C Hamano [this message]
2026-07-30  3:41 ` [PATCH 2/2] stash: reject time-based selectors in drop and pop Junio C Hamano

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=87h5lgtxw4.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=ben.knoble@gmail.com \
    --cc=git@vger.kernel.org \
    /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.