Re: [PATCH/RFC 1/3] stash: show less information for stash push -- <pathspec>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thomas Gummerer <t.gummerer@xxxxxxxxx> writes:

> 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 <peff@xxxxxxxx>
> Signed-off-by: Thomas Gummerer <t.gummerer@xxxxxxxxx>
> ---
>  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

Yup, we only said "HEAD is now at ..." in the non-pathspec case (and
we of course still do).  We didn't report changes to which paths
have been reverted in (or which new paths are removed from) the
working tree to the original state (and we of course still don't).

The messages from reset and clean that reports these probably do not
need to be shown by default to the users (they can always check with
"git stash show" when they are curious or when they want to double
check).







[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]