git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Junio C Hamano <gitster@pobox.com>
Date
May 19, 2021, 01:25 UTC
Message-ID
<xmqq35uj1pmd.fsf@gitster.g>
In-Reply-To
<76dfa90a32ae926f7477d5966109f81441eb2783.1621325684.git.liu.denton@gmail.com>
Denton Liu <liu.denton@gmail.com> writes:
Show 15 quoted lines
> 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.

Previous: Denton LiuNext: Denton Liu
Message 2 of 4 in “stash show: don't setup default diff output format if --{include,only}-untracked given”
  1. stash show: don't setup default diff output format if --{include,only}-untracked givenDenton Liu, May 18, 2021
  2. Junio C HamanoMay 19, 2021
  3. Denton LiuMay 19, 2021
  4. Junio C HamanoMay 19, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.