Re: [PATCH 2/2 (v3)] reset: make the output more user-friendly.

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

 



Matthieu Moy <Matthieu.Moy@xxxxxxx> writes:

> git reset without argument displays a summary of the remaining
> unstaged changes. The problem with these is that they look like an
> error message, and the format is inconsistant with the format used in
> other places like "git diff --name-status".
>
> This patch mimics the output of "git diff --name-status", and adds a
> header to make it clear the output is informative, and not an error.
>
> It also changes the output of "git add --refresh --verbose" in the same
> way.
>
> Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx>

Thanks.  Will queue.

However, I'd change the justification.

    git reset without argument displays a summary of the local modification,
    like this:
    
        $ git reset
        Makefile: locally modified
    
    Some people have problems with this; they look like an error message.
    
    This patch makes its output mimic how "git checkout $another_branch"
    reports the paths with local modifications.  "git add --refresh --verbose"
    is changed in the same way.
    
    It also adds a header to make it clear that the output is informative,
    and not an error.
    
    Signed-off-by: Matthieu Moy <Matthieu.Moy@xxxxxxx>

The output from reset in question is merely an informative side effect, as
opposed to what you actively ask "git diff" to give as its primary output.
As such, your "consistency" argument is pretty weak.  There is no reason
to expect that the informative message to resemble one particular format
(namely, --name-status) and not another (e.g. --stat or --name-only), as
you are not explicitly specifying what format to use; nor we would want to
make it customizable--after all it is just a friendly reminder.

Informative output from "git checkout $branch" when there are local
changes is a much better precedent to refer to.

After applying your patch and having compared these two sets of output:

        (1) without changes

        $ git reset --hard
        $ git checkout mm/reset-report
        Already on 'mm/reset-report'
        $ git reset
        $ git add --refresh -v Makefile

        (2) with changes

        $ echo >>Makefile
        $ git add Makefile
        $ git checkout mm/reset-report
        M       Makefile
        Already on 'mm/reset-report'
        $ git reset
        Unstaged changes after reset:
        M       Makefile
        $ git add --refresh -v Makefile
        Unstaged changes after refreshing the index:
        M       Makefile

I am somewhat inclined to suggest that we should drop the new "Unstaged
changes after ..." message, though.

By the way, "Already on .../Switched to ..." noise from "git checkout" is
also very annoying.  It is useless to report that the command did exactly
what the user told it to do.  Even more annoyingly, "git checkout -q" to
squelch this useless noise also squelches the "here are the paths you have
local changes" reminder, which is much more useful.

But that is a separate topic.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]