Merge branch 'tg/stash-with-pathspec-fix'
[gitweb.git] / git-stash.sh
index 1114005ce2829011cde2e6de608a2b90df355fc9..fc8f8ae6401dddcceaa82f9e9c748f5c185536d6 100755 (executable)
@@ -322,10 +322,9 @@ push_stash () {
 
                if test $# != 0
                then
-                       git reset -q -- "$@"
-                       git ls-files -z --modified -- "$@" |
+                       git add -u -- "$@" |
                        git checkout-index -z --force --stdin
-                       git clean --force -q -d -- "$@"
+                       git diff-index -p --cached --binary HEAD -- "$@" | git apply --index -R
                else
                        git reset --hard -q
                fi