git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Felipe Contreras <felipe.contreras@gmail.com>
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:56:06 -0400	[thread overview]
Message-ID: <20130908045606.GF14019@sigill.intra.peff.net> (raw)
In-Reply-To: <CAMP44s2PFVAKRUkEyN8BAH8C5UUMn21ou9hNkcOXaCsXscywHQ@mail.gmail.com>

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.

-Peff

  reply	other threads:[~2013-09-08  4:56 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 [this message]
2013-09-08  5:01                 ` Felipe Contreras

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=20130908045606.GF14019@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=felipe.contreras@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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.
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).