Thread (13 messages) 13 messages, 2 authors, 2025-06-10

Re: [PATCH v3 0/2] stash: fix and improve "git stash -p <pathspec>"

From: Phillip Wood <hidden>
Date: 2025-06-09 09:42:27

Hi Martin

On 07/06/2025 13:56, Martin Ågren wrote:
Hi Phillip,

On Sat, 7 Jun 2025 at 11:45, Phillip Wood [off-list ref] wrote:
[...]
This range-diff matches what I'd expect. Now this test makes sure we
really pick up the `-p`. On that note ... I just realized that all of
these would keep the test passing:

  test_write_lines s y n | git stash -p file # what you have
  test_write_lines s y n | git stash -p file otherfile
  test_write_lines s y n | git stash -p .
  test_write_lines s y n | git stash -p

So the implementation under test could bungle the pathspec, query the
user for both `file` and `otherfile` (in that order!), get EOF from
stdin while handling `otherfile`, leave it out of the stash, and end up
passing the test. We could try to protect against this by providing
another "y": if git wants to read something after our "s y n" sequence,
we'll give it a "y" in the hopes that it will trip things up. We do want
to test the handling of pathspecs here, so maybe tighten this?
Junio has merged this to next now. I was hoping that we would already 
have coverage for this with other tests but I couldn't see anything so 
I'll look at improving the coverage for "git stash push -p <pathspec>" 
in the next release cycle.

Thanks

Phillip
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help