Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: Re: [PATCH 0/2] git stash drop stash@{2.days.ago}
Date: Thu, 30 Jul 2026 13:29:39 -0700	[thread overview]
Message-ID: <xmqqjyqcjk5o.fsf@gitster.g> (raw)
In-Reply-To: <20260730034108.765430-1-gitster@pobox.com> (Junio C. Hamano's message of "Wed, 29 Jul 2026 20:41:06 -0700")

Junio C Hamano <gitster@pobox.com> writes:

> Because 'stash' is implemented in terms of the reflog, it can accept
> not only a small integer index (such as 'stash@{4}') but also a
> time-based reference.  This is not a good thing.
>
>  - 'git stash pop stash@{2.days.ago}' picks the first stash entry
>    that is no younger than the specified time and uses it to modify
>    the working tree and the index, but then removes all stash
>    entries that are no younger than that specified time.
>
>  - 'git stash drop stash@{2.days.ago}' does the same, except that
>    no entry is used to affect the working tree and the index.
>
> These two patches forbid passing time-based stash references to the
> 'git stash drop' and 'git stash pop' commands as minor safety
> improvements.
>
>  1/2: stash: record positional index in 'struct stash_info'
>  2/2: stash: reject time-based selectors in drop and pop
>
>  Documentation/git-stash.adoc |  8 ++++++++
>  builtin/stash.c              | 18 ++++++++++++++++++
>  t/t3903-stash.sh             | 13 +++++++++++++
>  3 files changed, 39 insertions(+)

Sorry, it turns out that the collateral damange claim was completely
bogus.  We do abuse the reflog expiration machinery but make sure we
only remove a single entry, it seems, so only one entry is consumed
and then removed.  Consider these patches retracted.

Thanks.

      parent reply	other threads:[~2026-07-30 20:29 UTC|newest]

Thread overview: 6+ 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
2026-07-30  3:41 ` [PATCH 2/2] stash: reject time-based selectors in drop and pop Junio C Hamano
2026-07-30 20:29 ` Junio C Hamano [this message]

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=xmqqjyqcjk5o.fsf@gitster.g \
    --to=gitster@pobox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox