git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 4/4] t: branch: improve test rollback
Date: Sun, 8 Sep 2013 00:01:11 -0500	[thread overview]
Message-ID: <CAMP44s3PPrtr2ham2LWeeGu3tV+2qBd2Xhv1X5RCntbubUvFuw@mail.gmail.com> (raw)
In-Reply-To: <20130908045606.GF14019@sigill.intra.peff.net>

On Sat, Sep 7, 2013 at 11:56 PM, Jeff King <peff@peff.net> wrote:
> On Sat, Sep 07, 2013 at 10:02:59PM -0500, Felipe Contreras wrote:
>
>> 'git checkout -' works perfectly fine, and it's the closest we have to
>> my suggested test_checkout() which I think would be ideal, but I'm not
>> going to work on.
>
> I do not think it works perfectly fine if the checkout itself fails. For
> example, after your patch, one of the tests reads:
>
>   test_when_finished "git checkout -" &&
>   git checkout HEAD^{} &&
>   test_must_fail git branch --set-upstream-to master
>
> The cleanup is undoing what happened on the second line. So if we fail
> on the third line, it does what we want. If we fail on the second line,
> then what branch are switching to?
>
> I think you would at least want to reverse the order as:
>
>   git checkout HEAD^{} &&
>   test_when_finished "git checkout -" &&
>   test_must_fail git branch --set-upstream-to master
>
> so that you know you are actually going to the pre-test state.

Yeah, that would be better and easily achievable.

-- 
Felipe Contreras

      reply	other threads:[~2013-09-08  5:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-31  4:31 [PATCH 0/4] t: branch: fixes and cleanups Felipe Contreras
2013-08-31  4:31 ` [PATCH 1/4] t: branch: trivial style fix Felipe Contreras
2013-09-03 19:13   ` Junio C Hamano
2013-08-31  4:31 ` [PATCH 2/4] t: branch: fix typo Felipe Contreras
2013-08-31  4:31 ` [PATCH 3/4] t: branch: fix broken && chains Felipe Contreras
2013-08-31  4:31 ` [PATCH 4/4] t: branch: improve test rollback Felipe Contreras
2013-09-03 19:32   ` Junio C Hamano
2013-09-03 22:10     ` Felipe Contreras
2013-09-03 22:59       ` Junio C Hamano
2013-09-03 23:03         ` Felipe Contreras
2013-09-04 17:19           ` Junio C Hamano
2013-09-08  3:02             ` Felipe Contreras
2013-09-08  4:56               ` Jeff King
2013-09-08  5:01                 ` Felipe Contreras [this message]

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

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

  git send-email \
    --in-reply-to=CAMP44s3PPrtr2ham2LWeeGu3tV+2qBd2Xhv1X5RCntbubUvFuw@mail.gmail.com \
    --to=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
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 NNTP newsgroup(s).