On 03/15, Marc Strapetz wrote:
> On 14.03.2018 22:46, Thomas Gummerer wrote:
> >Currently 'git stash push -u -- <pathspec>' prints the following errors
> >if <pathspec> only matches untracked files:
> >
> >     fatal: pathspec 'untracked' did not match any files
> >     error: unrecognized input
> >
> >This is because we first clean up the untracked files using 'git clean
> ><pathspec>', and then use a command chain involving 'git add -u
> ><pathspec>' and 'git apply' to clear the changes to files that are in
> >the index and were stashed.
> >
> >As the <pathspec> only includes untracked files that were already
> >removed by 'git clean', the 'git add' call will barf, and so will 'git
> >apply', as there are no changes that need to be applied.
> >
> >Fix this by making sure to only call this command chain if there are
> >still files that match <pathspec> after the call to 'git clean'.
> >
> >Reported-by: Marc Strapetz <marc.strap...@syntevo.com>
> >Signed-off-by: Thomas Gummerer <t.gumme...@gmail.com>
> >---
> >
> >>Either way I'll try to address this as soon as I can get some
> >>time to look at it.
> >
> >I finally got around to do this.  The fix (in the second patch) turns
> >out to be fairly simple, I just forgot to pass the pathspec along to
> >one function whene originally introducing the pathspec feature in git
> >stash push (more explanation in the commit message for the patch
> >itself).  Thanks Marc for reporting the two breakages!
> 
> Thanks, I confirm that both issues are resolved. There is another issue now
> which seems to be a regression. When *successfully* stashing an untracked
> file, local modifications of other files are cleared, too.
> 
> $ git init
> $ touch file1
> $ git add file1
> $ git commit -m "initial import"
> $ echo "a" > file1
> $ touch file2
> $ git status --porcelain
>  M file1
> ?? file2
> $ git stash push -u -- file2
> Saved working directory and index state WIP on master: 25352d7 initial
> import
> $ git status
> On branch master
> nothing to commit, working tree clean
> 
> Hence, by stashing just "file2" the local modification of "file1" became
> reset.

Ah yes, this is indeed a regression, thanks for catching it.  I'll fix
it in the re-roll and add another test for this case.  Sorry about the
false starts here :/

> -Marc
> 
> 
> 
> 

Reply via email to