Subject: Re: [PATCH] stash show: don't setup default diff output format if --{include,only}-untracked given

From: Denton Liu <[email-masked]>
Date: Wed, 19 May 2021 02:23:44 -0700

Hi Junio,

On Wed, May 19, 2021 at 10:25:30AM +0900, Junio C Hamano wrote:
> Denton Liu <[email-masked]> writes:
> 
> > When `git stash show` is given no arguments, it will pass `--stat` to
> > `git diff` by default. When any argument is given, `--stat` is no longer
> > passed by default.
> >
> > When `git stash show` learned the `--include-untracked` and
> > `--only-untracked` options, it failed to retain the same behaviour of
> > not passing `--stat` by default.
> >
> > This isn't necessarily incorrect since with other arguments, they're
> > passed through directly to `git diff` which means it wouldn't make sense
> > to pass `--stat` as well. With `--include-untracked` and
> > `--only-untracked`, they are handled by `git stash show` directly
> > meaning we don't necessarily have this conflict. However, this would be
> > unintuitive for users since the existing behaviour seems to be that if
> > any arguments are given, `--stat` will not be given by default.
> 
> But even for users who do not care about the implementation, the
> options that affect "What to show" and "How to show them" are easily
> distinguishable at the conceptual level, no?  When showing stash
> without telling the command what or how to show, we omit untracked
> part by default, and we show only diffstat by default.  When we tell
> it to show also/only untracked, it is unclear if it is confusing or
> natural to average users if that affects how the chosen part of the
> stash gets shown.
> 
> Showing untracked will be a new feature in the upcoming release, so
> we may want to either (1) revert the whole thing before we can agree
> on the desired behaviour or (2) clarify in the document that what to
> show and how to show them are two orthogonal axes with their own
> default that are orthogonal to avoid the "confusion" you are trying
> to address with this patch.

I could be convinced either way and I was erring on the side of caution
by proposing this patch. I'm okay with the status quo so we can keep the
behaviour as is, unless someone objects in which case we should revert
pending more discussion.

I'll send a follow-up patch later this week clarifying the docs.

Thanks,
Denton