Re: [BUG] "git stash -- path" reports wrong unstaged changes
- From
Jeff King <peff@peff.net>
- Date
- Mar 20, 2017, 18:41 UTC
- Message-ID
- <20170320184156.sji45up2aba7z3ws@sigill.intra.peff.net>
- In-Reply-To
- <20170318183658.GC27158@hank>
On Sat, Mar 18, 2017 at 06:36:58PM +0000, Thomas Gummerer wrote:
Show 18 quoted lines
> > + if test -z "$GIT_QUIET" && ! git diff-files --quiet
> > + then
> > + say "$(gettext "Unstaged changes after reset:")"
> > + git diff-files --name-status
> > + fi
> > else
> > git reset --hard ${GIT_QUIET:+-q}
> > fi
>
> This would mean the user gets something like in your case above:
>
> Unstaged changes after reset:
> M two
>
> As a user that doesn't know the internal implementation of push_stash,
> this would make me wonder why git stash would mention a file that is
> not provided as pathspec, but not the one that was provided in the
> pathspec argument.That's a good point. I was going for consistency with the non-pathspec case, but of course it wouldn't mention any files in the first place, because it's just done a complete "git reset --hard".
Show 6 quoted lines
> I think one option would be to to just keep quiet about the exact > changes that git stash push makes, similar to what we do in the > --include-untracked and in the -p case. The other option would be to > find the files that are affected and print them, but that would > probably be a bit too noisy especially in cases such as > git stash push -- docs/*.
Yeah, that's the right thing. I was just trying to be too clever above.
-Peff