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

Re: [PATCH] status: teach "status --short" to respect "--show-stash"

From
Eric N. Vander Weele <ericvw@gmail.com>
Date
Nov 7, 2019, 10:31 UTC
Message-ID
<20191107103141.GA87008@helium>
In-Reply-To
<xmqq36f1wx6h.fsf@gitster-ct.c.googlers.com>
On Wed, Nov 06, 2019 at 11:33:42AM +0900, Junio C Hamano wrote:
Show 29 quoted lines
> "Eric N. Vander Weele" <ericvw@gmail.com> writes:
> 
> > Enable printing the entries currently stashed away in the short format.
> > This prints the stash information after the path status to be symmetric
> > with "status --long --show-stash".
> >
> > Signed-off-by: Eric N. Vander Weele <ericvw@gmail.com>
> > ---
> >  Documentation/git-status.txt |  4 ++++
> >  wt-status.c                  | 17 +++++++++++++++++
> >  2 files changed, 21 insertions(+)
> >
> > diff --git a/Documentation/git-status.txt b/Documentation/git-status.txt
> > index 7731b45f07..c1afc3282c 100644
> > --- a/Documentation/git-status.txt
> > +++ b/Documentation/git-status.txt
> > @@ -244,6 +244,10 @@ If -b is used the short-format status is preceded by a line
> >  
> >      ## branchname tracking info
> >  
> > +If --show-stash is used the short-format status is followed by a line
> > +
> > +    ## stash: <n> (entry|entries)
> > +
> 
> Hmmmm.  Would readers misinterpret we are talking about a branch
> whose name is stash something?  I am not suggesting to change ##
> introducer to some random letters, which would break scripts even
> worse.

I could see where readers may misinterpret this as a branch name. I struggled coming up with something short while not being confusing and thought the presence ':' followed by a space would be clear enough.

> Doesn't the Porcelain Format v1 call the same codepath as
> shortstatus?  We promise that its output never changes to support
> existing scripts, but now they will start seeing "## stash:" that
> they do not understand and barf?

I wasn't aware of the Porcelain formats in detail when originally creating the patch - oops! Naively I was following the same behavior as '--branch' in the shortstatus code path.

Diving into this further, the Porcelain Format v1 does call the same code path as shortstatus. I see there is some handling in builtin/commit.c for tweaking the behavior of the branch being showed.

The documentation indicates that the behavior never changes between Git versions or based on user configuration. 'git status --porcelain=1' will react to '--branch' but not when 'status.branch' is set to 'true', which is congruent with the documentation.

> Isn't this information available to scripts that want to read from
> porcelain v2 output format (which is meant to be extensible by
> allowing easy-to-parse optional headers, which this stash thing
> exactly is).
It is not available in Porcelain Format v2... yet :).

I'm happy making '--show-stash' congruent with '--branch' in v1', which is would be in line with documented behavior, displaying something in v2 only, or both. Let me know how you would like to proceed and I'll rework the patch accordingly.

Previous: Junio C HamanoNext: Junio C Hamano
Message 3 of 5 in “status: teach "status --short" to respect "--show-stash"”
  1. status: teach "status --short" to respect "--show-stash"Eric N. Vander Weele, Nov 4, 2019
  2. Junio C HamanoNov 6, 2019
  3. Eric N. Vander WeeleNov 7, 2019
  4. Junio C HamanoNov 7, 2019
  5. Eric N. Vander WeeleNov 8, 2019

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.