Skip to content

git stash drop stash@{2.days.ago}

Junio C Hamano git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2stash: record positional index in 'struct stash_info'builtin/stash.c+15 -02 replies
2/2stash: reject time-based selectors in drop and popDocumentation/git-stash.adoc builtin/stash.c t/t3903-stash.sh+24 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] git stash drop stash@{2.days.ago}

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(+)
Signature · 1 line
2.55.0-597-ge6126a35d6