{"thread":{"id":"55150","subject":"Short status ignores --show-stash option","startedAt":"2021-02-15T20:03:55Z","lastAt":"2021-02-16T20:24:24Z","messageCount":3,"participants":["janek","Taylor Blau","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"416973","messageId":"5ofQpdi3EmG_V-LqPrL6ZttzenOKG9xQ9MCdQ1OK7b_NcFZX0hqqmwr8mr2KByFwRa8ljzX4vj-_34Q6aPcXdZ8_qDahZfFSyJKj5cfyAjc=@protonmail.com","threadId":"55150","inReplyTo":null,"subject":"Short status ignores --show-stash option","fromName":"janek","fromEmail":"27jf@protonmail.com","sentAt":"2021-02-15T20:02:24Z","receivedAt":"2021-02-15T20:03:55Z","isPatch":false,"sender":{"key":"27jf@protonmail.com","avatar":null},"body":"What did you do before the bug happened? (Steps to reproduce your issue)\ngit status --short --show-stash --branch\n\nWhat did you expect to happen? (Expected behavior)\nThe status shows info about the stash, e.g. next to the branch infos\n\nWhat happened instead? (Actual behavior)\n--show-stash is ignored when using short format\n\n[System Info]\ngit version:\ngit version 2.30.1\ncpu: x86_64\nno commit associated with this build\nsizeof-long: 8\nsizeof-size_t: 8\nshell-path: /bin/sh\nuname: Linux 5.10.15-arch1-1 #1 SMP PREEMPT Wed, 10 Feb 2021 18:32:40 +0000 x86_64\ncompiler info: gnuc: 10.2\nlibc info: glibc: 2.33\n$SHELL (typically, interactive shell): /bin/zsh\n\n[Enabled Hooks]\npost-commit\npost-checkout\npost-merge\npre-push\n\nRegards,\nJanek\n"},{"id":"417081","messageId":"YCwOA/CcPEA/he1X@nand.local","threadId":"55150","inReplyTo":"5ofQpdi3EmG_V-LqPrL6ZttzenOKG9xQ9MCdQ1OK7b_NcFZX0hqqmwr8mr2KByFwRa8ljzX4vj-_34Q6aPcXdZ8_qDahZfFSyJKj5cfyAjc=@protonmail.com","subject":"Re: Short status ignores --show-stash option","fromName":"Taylor Blau","fromEmail":"ttaylorr@github.com","sentAt":"2021-02-16T18:25:32Z","receivedAt":"2021-02-16T18:26:34Z","isPatch":false,"sender":{"key":"ttaylorr@github.com","avatar":"https://gravatar.com/avatar/d5f3476f26b6f99cbb6b467e7ed7482f5762c8157bc73f569196e428bdcbea25?d=mp&s=160"},"body":"On Mon, Feb 15, 2021 at 08:02:24PM +0000, janek wrote:\n> What did you do before the bug happened? (Steps to reproduce your issue)\n> git status --short --show-stash --branch\n>\n> What did you expect to happen? (Expected behavior)\n> The status shows info about the stash, e.g. next to the branch infos\n>\n> What happened instead? (Actual behavior)\n> --show-stash is ignored when using short format\n\nHmm. It's certainly possible to do something like:\n\ndiff --git a/wt-status.c b/wt-status.c\nindex 0c8287a023..397d36544d 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -2013,6 +2013,9 @@ static void wt_shortstatus_print(struct wt_status *s)\n\n        for_each_string_list_item(it, &s->ignored)\n                wt_shortstatus_other(it, s, \"!!\");\n+\n+       if (s->show_stash)\n+               wt_longstatus_print_stash_summary(s);\n }\n\n static void wt_porcelain_print(struct wt_status *s)\n\nand that would cause 'git status' to do what you expect:\n\n    $ git.compile status --short --branch --show-stash\n    ## tb/empty-trailer-continuation\n     M wt-status.c\n     Your stash currently has 16 entries\n\nBut it may not be the right thing to do, since that explicitly breaks\nthe --porcelain format. We may want something like this in addition to\nthe above:\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex 739110c5a7..ef855896a2 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -1414,6 +1414,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n            s.show_untracked_files == SHOW_NO_UNTRACKED_FILES)\n                die(_(\"Unsupported combination of ignored and untracked-files arguments\"));\n\n+       if (status_format == STATUS_FORMAT_PORCELAIN ||\n+           status_format == STATUS_FORMAT_PORCELAIN_V2) {\n+               if (s.show_stash)\n+                       die(_(\"--porcelain is incompatible with --show-stash\"));\n+       }\n+\n        parse_pathspec(&s.pathspec, 0,\n                       PATHSPEC_PREFER_FULL,\n                       prefix, argv);\n\nThanks,\nTaylor\n"},{"id":"417104","messageId":"YCwpr29Ghdk3ye1u@coredump.intra.peff.net","threadId":"55150","inReplyTo":"YCwOA/CcPEA/he1X@nand.local","subject":"Re: Short status ignores --show-stash option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2021-02-16T20:23:11Z","receivedAt":"2021-02-16T20:24:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Feb 16, 2021 at 01:25:32PM -0500, Taylor Blau wrote:\n\n> and that would cause 'git status' to do what you expect:\n> \n>     $ git.compile status --short --branch --show-stash\n>     ## tb/empty-trailer-continuation\n>      M wt-status.c\n>      Your stash currently has 16 entries\n> \n> But it may not be the right thing to do, since that explicitly breaks\n> the --porcelain format. We may want something like this in addition to\n> the above:\n> \n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index 739110c5a7..ef855896a2 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -1414,6 +1414,12 @@ int cmd_status(int argc, const char **argv, const char *prefix)\n>             s.show_untracked_files == SHOW_NO_UNTRACKED_FILES)\n>                 die(_(\"Unsupported combination of ignored and untracked-files arguments\"));\n> \n> +       if (status_format == STATUS_FORMAT_PORCELAIN ||\n> +           status_format == STATUS_FORMAT_PORCELAIN_V2) {\n> +               if (s.show_stash)\n> +                       die(_(\"--porcelain is incompatible with --show-stash\"));\n> +       }\n> +\n\nI think ideally we'd define a porcelain format for it, since v2 has\nexplicit support for extending with new headers. Something like:\n\n  # stash.number 16\n\nwould probably work. I don't think it's _strictly_ necessary, in that\nthe die() above does not paint us into a corner. We can always loosen it\nlater. But it is easy enough that it probably makes sense to just define\nit while we are here.\n\nAnd in particular, I think we may want to mimic it for --short, rather\nthan just showing the \"long\" output, which IMHO is kind of dissonant in\nterms of the formatting (though again, we reserve the right to change\n--short, so I don't think we've painted ourselves into a corner).\n\n-Peff\n"}]}