Re: git stash push -u always warns "pathspec '...' did not match any files"
- From
Marc Strapetz <marc.strapetz@syntevo.com>
- Date
- Mar 4, 2018, 10:44 UTC
- Message-ID
- <08d765ec-b2d7-7087-fca5-2eecefcef9cf@syntevo.com>
- In-Reply-To
- <20180303154654.GH2130@hank>
On 03.03.2018 16:46, Thomas Gummerer wrote:
Show 15 quoted lines
> On 03/03, Marc Strapetz wrote: >> Reproducible in a test repository with following steps: >> >> $ touch untracked >> $ git stash push -u -- untracked >> Saved working directory and index state WIP on master: 0096475 init >> fatal: pathspec 'untracked' did not match any files >> error: unrecognized input >> >> The file is stashed correctly, though. >> >> Tested with Git 2.16.2 on Linux and Windows. > > Thanks for the bug report and the reproduction recipe. The following > patch should fix it:
Thanks, I can confirm that the misleading warning message is fixed.
What I've noticed now is that when using -u option, Git won't warn if the pathspec is actually not matching a file. Also, an empty stash may be created. For example:
$ git stash push -u -- nonexisting Saved working directory and index state WIP on master: 171081d initial import
I would probably expect to see an error message as for:
$ git stash push -- nonexisting error: pathspec 'nonexisting' did not match any file(s) known to git. Did you forget to 'git add'?
That said, this is no problem for us, because I know that the paths I'm providing to "git stash push" do exist. I just wanted to point out.
-Marc