Web lists-archives.com

[PATCH/RFC 3/3] stash: pass the pathspec argument to git reset




For "git stash -p --no-keep-index", the pathspec argument is currently
not passed to "git reset".  This means that changed that are staged but
that are excluded from the pathspec still get unstaged by git stash -p.

Make sure that doesn't happen by passing the pathspec argument to the
git reset in question, bringing the behaviour in line with "git stash --
<pathspec>".

Signed-off-by: Thomas Gummerer <t.gummerer@xxxxxxxxx>
---
So this make things a bit inconsistent in for example the following
situation:

    $ git status -s
     M git-stash.sh
    M  read-cache.c

where using git stash -p --no-keep-index, when only changes in
git-stash.sh are added to the stash would reset read-cache.c, but with
git stash -p --no-keep-index -- git-stash.sh, read-cache.c would not
be reset.  

However it does bring things more in line with git stash --
<pathspec>, so I think this is an improvement.

 git-stash.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-stash.sh b/git-stash.sh
index c58f98f1d6..2d5c9a609c 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -322,7 +322,7 @@ push_stash () {
 
 		if test "$keep_index" != "t"
 		then
-			git reset ${GIT_QUIET:+-q}
+			git reset ${GIT_QUIET:+-q} -- "$@"
 		fi
 	fi
 }
-- 
2.12.0.483.gad4152297