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

Re: [PATCH 2/2] status: print stash info with --porcelain=v2 --show-stash

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Oct 22, 2021, 01:19 UTC
Message-ID
<CAPig+cTMC0ZAkdzwQ6qu9ra0bjBGDP5wtsqccnbFq+0cdTRiSw@mail.gmail.com>
In-Reply-To
<xmqq4k99gava.fsf@gitster.g>
On Thu, Oct 21, 2021 at 8:30 PM Junio C Hamano <gitster@pobox.com> wrote:
Show 19 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
> >> +       test_when_finished "git stash pop && git stash pop" &&
> >
> > If it's indeed important to clean up the stashes when the test
> > finishes, then the test_when_finished() invocation should probably be
> > a bit more robust...
> >
> >> +       git stash -- file_x &&
> >> +       git stash &&
> >
> > ... since, as it is now, if an error occurs between these two
> > git-stash invocations or before them, then there will only be zero or
> > one stashes, so the double stash-pop by test_when_finished() will
> > itself errout out. Better, perhaps to do this:
> >
> >     test_when_finished "git stash pop && git stash pop || :" &&
>
> There is no "I do not care what is in the stash right now, just
> clear all"?

Indeed, I wondered that too but was too lazy to look and I had forgotten about `git stash clear`, which makes this much simpler:

    test_when_finished "git stash clear" &&
Previous: Junio C Hamano
Message 8 of 8 in “Print stash info in the v2 porcelain format”
  1. 0/2 Print stash info in the v2 porcelain formatØystein Walle, Oct 21, 2021
  2. 1/2 status: count stash entries in separate functionØystein Walle, Oct 21, 2021
  3. Junio C HamanoOct 21, 2021
  4. 2/2 status: print stash info with --porcelain=v2 --show-stashØystein Walle, Oct 21, 2021
  5. Junio C HamanoOct 21, 2021
  6. Eric SunshineOct 22, 2021
  7. Junio C HamanoOct 22, 2021
  8. Eric SunshineOct 22, 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.