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

Re: Short status ignores --show-stash option

From
Taylor Blau <ttaylorr@github.com>
Date
Feb 16, 2021, 18:25 UTC
Message-ID
<YCwOA/CcPEA/he1X@nand.local>
In-Reply-To
<5ofQpdi3EmG_V-LqPrL6ZttzenOKG9xQ9MCdQ1OK7b_NcFZX0hqqmwr8mr2KByFwRa8ljzX4vj-_34Q6aPcXdZ8_qDahZfFSyJKj5cfyAjc=@protonmail.com>
On Mon, Feb 15, 2021 at 08:02:24PM +0000, janek wrote:
Show 8 quoted lines
> What did you do before the bug happened? (Steps to reproduce your issue)
> git status --short --show-stash --branch
>
> What did you expect to happen? (Expected behavior)
> The status shows info about the stash, e.g. next to the branch infos
>
> What happened instead? (Actual behavior)
> --show-stash is ignored when using short format
Hmm. It's certainly possible to do something like:
diff --git a/wt-status.c b/wt-status.c
index 0c8287a023..397d36544d 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -2013,6 +2013,9 @@ static void wt_shortstatus_print(struct wt_status *s)

        for_each_string_list_item(it, &s->ignored)
                wt_shortstatus_other(it, s, "!!");
+
+       if (s->show_stash)
+               wt_longstatus_print_stash_summary(s);
 }

 static void wt_porcelain_print(struct wt_status *s)

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"));
+       }
+
        parse_pathspec(&s.pathspec, 0,
                       PATHSPEC_PREFER_FULL,
                       prefix, argv);

Thanks,
Taylor
Previous: janekNext: Jeff King
Message 2 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.