When using git stash push -- <pathspec> in the following sequence:

       git init -q repo
       cd repo

       for i in one two; do
               echo content >$i
               git add $i
       done
       git commit -qm base

       for i in one two; do
               echo change >$i
       done
       git stash -- one

it shows:

   Saved working directory and index state WIP on master: 20cfadf base
   Unstaged changes after reset:
    M   one
    M   two

Even though "one" no longer has unstaged changes.

It really is enough for the user to know that the stash is created,
without bothering them with the internal details of what's happening.
Always pass the -q flag to git clean and git reset in the pathspec case,
to avoid unnecessary and potentially confusing output.

Reported-by: Jeff King <[email protected]>
Signed-off-by: Thomas Gummerer <[email protected]>
---
 git-stash.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/git-stash.sh b/git-stash.sh
index 9c70662cc8..59f055e27b 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -299,10 +299,10 @@ push_stash () {
        then
                if test $# != 0
                then
-                       git reset ${GIT_QUIET:+-q} -- "$@"
+                       git reset -q -- "$@"
                        git ls-files -z --modified -- "$@" |
                        git checkout-index -z --force --stdin
-                       git clean --force ${GIT_QUIET:+-q} -d -- "$@"
+                       git clean --force -q -d -- "$@"
                else
                        git reset --hard ${GIT_QUIET:+-q}
                fi
-- 
2.12.0.483.gad4152297

Reply via email to