summaryrefslogtreecommitdiffstats
path: root/git-stash.sh
diff options
context:
space:
mode:
authorThomas Gummerer <t.gummerer@gmail.com>2017-03-21 23:12:19 +0100
committerJunio C Hamano <gitster@pobox.com>2017-03-22 22:55:56 +0100
commite0e7f99ea400808cd11af72425c721c8b44193ca (patch)
tree74d382c2a274fc8f897a31ba071bfcc2cc507e44 /git-stash.sh
parentstash: pass the pathspec argument to git reset (diff)
downloadgit-e0e7f99ea400808cd11af72425c721c8b44193ca.tar.xz
git-e0e7f99ea400808cd11af72425c721c8b44193ca.zip
stash: keep untracked files intact in stash -k
Currently when there are untracked changes in a file "one" and in a file "two" in the repository and the user uses: git stash push -k one all changes in "two" are wiped out completely. That is clearly not the intended result. Make sure that only the files given in the pathspec are changed when git stash push -k <pathspec> is used. Reported-by: Jeff King <peff@peff.net> Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'git-stash.sh')
-rwxr-xr-xgit-stash.sh4
1 files changed, 3 insertions, 1 deletions
diff --git a/git-stash.sh b/git-stash.sh
index 13711764a9..2fb651b2b8 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -314,7 +314,9 @@ push_stash () {
if test "$keep_index" = "t" && test -n "$i_tree"
then
- git read-tree --reset -u $i_tree
+ git read-tree --reset $i_tree
+ git ls-files -z --modified -- "$@" |
+ git checkout-index -z --force --stdin
fi
else
git apply -R < "$TMP-patch" ||