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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2018, 01:53 UTC
Message-ID
<xmqqr2gdeanh.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAPig+cRVdogY8VLXcftbY=n9tQ9wDo4YrnrdU6+pZ3ch6uhZGA@mail.gmail.com>
Eric Sunshine <sunshine@sunshineco.com> writes:
Show 7 quoted lines
>> +       test_when_finished "
>> +               git checkout branch-one
>> +               git branch -D branch-and-tag-name
>> +       " &&
>> +       git checkout -b branch-and-tag-name &&
>> +       test_when_finished "git tag -d branch-and-tag-name" &&
>> +       git tag branch-and-tag-name &&

We've discussed about the exit status from clean-up code already, but another thing worth noticing is that it probably is easier to see what is going on if we use a single when-finished to clear both branch and the tag with the same name. Something like

	test_when_finished "
		git checkout branch-one
		git branch -D branch-and-tag-name
		git tag -d branch-and-tag-name
		:
	" &&

upfront before doing anything else. "checkout" may break if the test that follows when-finished accidentally removes branch-one and that would cascade to a failure to remove branch-and-tag-name branch (because we fail to move away from it), but because there is no && in between, we'd clean as much as we could in such a case, which may or may not be a good thing. And then we hide the exit code by having a ":" at the end.

Previous: Jeff KingNext: Rafael Ascensão
Message 5 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.