Git 2.22 (Q2 2019), git stash
is rewritten in C.
See commit 7906af0, commit 90a4627, commit 8d8e9c2 (25 Feb 2019) by Johannes Schindelin (dscho
).
See commit 40af146, commit 48ee24a, commit ef0f0b4, commit 64fe9c2, commit 1ac528c, commit d553f53, commit d4788af, commit 41e0dd5, commit dc7bd38, commit 130f269, commit bef55dc, commit dac566c, commit ab8ad46 (25 Feb 2019) by Paul-Sebastian Ungureanu (weekly-digest[bot]
).
See commit c4de61d, commit 577c199, commit 4e2dd39, commit 8a0fc8d (25 Feb 2019) by Joel Teichroeb (klusark
).
(Merged by Junio C Hamano -- gitster
-- in commit e36adf7, 22 Apr 2019)
And... "git stash show 23
" used to work, but no more after getting rewritten in C; this regression has been corrected in Git 2.23 (Q3 2019).
See commit 63b50c8 (15 Jun 2019) by Thomas Gummerer (tgummerer
).
(Merged by Junio C Hamano -- gitster
-- in commit 99af5be, 09 Jul 2019)
stash: fix show referencing stash index
In the conversion of 'stash show
' to C in dc7bd38 ("stash
: convert
show to builtin", 2019-02-25, Git v2.22.0-rc0), 'git stash show <n>
', where n
is the
index of a stash got broken, if n
is not a file or a valid revision by
itself.
'stash show
' accepts any flag 'git diff
' accepts for changing the output format.
Internally we use 'setup_revisions()
' to parse these command line flags.
Currently we pass the whole argv
through to 'setup_revisions()
', which includes the stash index.
As the stash index is not a valid revision or a file in the working tree in most cases however, this 'setup_revisions()
' call (and thus the whole command) ends up failing if we use this form of 'git stash show
'.
Instead of passing the whole argv
to 'setup_revisions()
', only pass
the flags (and the command name) through, while excluding the stash
reference.
The stash reference is parsed (and validated) in 'get_stash_info()
' already.
This separate parsing also means that we currently do produce the
correct output if the command succeeds.
git stash --<Tab><Tab>
and make a right conclusion after. – Hemotherapy