git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Daniels Umanovskis <daniels@umanovskis.se>,
	Git List <git@vger.kernel.org>
Subject: Re: [PATCH v5] branch: introduce --show-current display option
Date: Fri, 26 Oct 2018 10:53:22 +0900	[thread overview]
Message-ID: <xmqqr2gdeanh.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <CAPig+cRVdogY8VLXcftbY=n9tQ9wDo4YrnrdU6+pZ3ch6uhZGA@mail.gmail.com> (Eric Sunshine's message of "Thu, 25 Oct 2018 15:30:23 -0400")

Eric Sunshine <sunshine@sunshineco.com> writes:

>> +       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.



  parent reply	other threads:[~2018-10-26  1:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25 19:04 [PATCH v5] branch: introduce --show-current display option Daniels Umanovskis
2018-10-25 19:30 ` Eric Sunshine
2018-10-26  0:52   ` Junio C Hamano
2018-11-01 22:01     ` Jeff King
2018-10-26  1:53   ` Junio C Hamano [this message]
2018-11-07 22:56 ` [PATCH] branch: make --show-current use already resolved HEAD Rafael Ascensão
2018-11-08  1:11   ` Junio C Hamano
2018-11-08  4:36     ` Rafael Ascensão

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqr2gdeanh.fsf@gitster-ct.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=daniels@umanovskis.se \
    --cc=git@vger.kernel.org \
    --cc=sunshine@sunshineco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).