Thread (22 messages) flat view 22 messages, 2 authors, 2017-03-22

Re: [BUG] "git stash -- path" reports wrong unstaged changes

From: Jeff King <hidden>
Date: 2017-03-20 18:42:07

On Sat, Mar 18, 2017 at 06:36:58PM +0000, Thomas Gummerer wrote:
quoted
+			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".
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help