Git development
 help / color / mirror / Atom feed
* [PATCH 0/2] git stash drop stash@{2.days.ago}
@ 2026-07-30  3:41 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  3:41 ` [PATCH 2/2] stash: reject time-based selectors in drop and pop Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2026-07-30  3:41 UTC (permalink / raw)
  To: git

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(+)

-- 
2.55.0-597-ge6126a35d6


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-07-30  7:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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  3:41 ` [PATCH 2/2] stash: reject time-based selectors in drop and pop Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox