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

Re: [PATCH v5] branch: introduce --show-current display option

From
Jeff King <peff@peff.net>
Date
Nov 1, 2018, 22:01 UTC
Message-ID
<20181101220119.GA26383@sigill.intra.peff.net>
In-Reply-To
<xmqqefcdfs1j.fsf@gitster-ct.c.googlers.com>
On Fri, Oct 26, 2018 at 09:52:24AM +0900, Junio C Hamano wrote:
Show 12 quoted lines
> Eric Sunshine <sunshine@sunshineco.com> writes:
> 
> >> +       test_when_finished "git tag -d branch-and-tag-name" &&
> >> +       git tag branch-and-tag-name &&
> >
> > If git-tag crashes before actually creating the new tag, then "git tag
> > -d", passed to test_when_finished(), will error out too, which is
> > probably undesirable since "cleanup code" isn't expected to error out.
> 
> Ah, I somehow thought that clean-up actions set up via when_finished
> are allowed to fail without affecting the outcome, but apparently I
> was mistaken.

If a when_finished block fails, we consider that a test failure. But if we failed to create the tag, the test is failing anyway. Do we actually care at that point?

We would still want to make sure we run the rest of the cleanup, but looking at the definition of test_when_finished(), I think we do.

Show 6 quoted lines
> I haven't gone through the list of when_finished clean-up actions
> that do not end with "|| :"; I suspect some of them are simply being
> sloppy and would want to have "|| :", but what I want to find out
> out of such an audit is if there is a legitimate case where it helps
> to catch failures in the clean-up actions.  If there is none, then
> ...

I think in the success case it is legitimately helpful. If that "tag -d" failed above (after the tag creation and the rest of the test succeeded), it would certainly be unexpected and we would want to know that it happened. So I think "|| :" in this case is not just unnecessary, but actively bad.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 8 in “branch: introduce --show-current display option”
  1. branch: introduce --show-current display optionDaniels Umanovskis, Oct 25, 2018
  2. Eric SunshineOct 25, 2018
  3. Junio C HamanoOct 26, 2018
  4. Jeff KingNov 1, 2018
  5. Junio C HamanoOct 26, 2018
  6. branch: make --show-current use already resolved HEADRafael Ascensão, Nov 7, 2018
  7. Junio C HamanoNov 8, 2018
  8. Rafael AscensãoNov 8, 2018

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.