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

Re: Short status ignores --show-stash option

From
Jeff King <peff@peff.net>
Date
Feb 16, 2021, 20:23 UTC
Message-ID
<YCwpr29Ghdk3ye1u@coredump.intra.peff.net>
In-Reply-To
<YCwOA/CcPEA/he1X@nand.local>
On Tue, Feb 16, 2021 at 01:25:32PM -0500, Taylor Blau wrote:
Show 25 quoted lines
> and that would cause 'git status' to do what you expect:
> 
>     $ git.compile status --short --branch --show-stash
>     ## tb/empty-trailer-continuation
>      M wt-status.c
>      Your stash currently has 16 entries
> 
> But it may not be the right thing to do, since that explicitly breaks
> the --porcelain format. We may want something like this in addition to
> the above:
> 
> diff --git a/builtin/commit.c b/builtin/commit.c
> index 739110c5a7..ef855896a2 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -1414,6 +1414,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)
>             s.show_untracked_files == SHOW_NO_UNTRACKED_FILES)
>                 die(_("Unsupported combination of ignored and untracked-files arguments"));
> 
> +       if (status_format == STATUS_FORMAT_PORCELAIN ||
> +           status_format == STATUS_FORMAT_PORCELAIN_V2) {
> +               if (s.show_stash)
> +                       die(_("--porcelain is incompatible with --show-stash"));
> +       }
> +

I think ideally we'd define a porcelain format for it, since v2 has explicit support for extending with new headers. Something like:

  # stash.number 16

would probably work. I don't think it's _strictly_ necessary, in that the die() above does not paint us into a corner. We can always loosen it later. But it is easy enough that it probably makes sense to just define it while we are here.

And in particular, I think we may want to mimic it for --short, rather than just showing the "long" output, which IMHO is kind of dissonant in terms of the formatting (though again, we reserve the right to change --short, so I don't think we've painted ourselves into a corner).

-Peff
Previous: Taylor Blau
Message 3 of 3 in “Short status ignores --show-stash option”
  1. janekFeb 15, 2021
  2. Taylor BlauFeb 16, 2021
  3. Jeff KingFeb 16, 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.