git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Jeff King <peff@peff.net>
Cc: Junio C Hamano <gitster@pobox.com>,
	Sverre Rabbelier <srabbelier@gmail.com>,
	Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>,
	git@vger.kernel.org
Subject: Re: [1.8.0] git checkout refs/heads/foo checks out branch foo
Date: Mon, 7 Feb 2011 18:01:52 -0600	[thread overview]
Message-ID: <20110208000151.GA19944@elie> (raw)
In-Reply-To: <20110207234526.GA28336@sigill.intra.peff.net>

Jeff King wrote:

> Jonathan, do you want to roll all of these up into a single patch?

Sounds good.

> +++ b/t/t2020-checkout-detach.sh
[...]
> +check_detached() {
> +	! git symbolic-ref -q HEAD >/dev/null
> +}
> +
> +check_not_detached() {
> +	! check_detached
> +}

To be pedantic, I'll put

 check_detached () {
	test_must_fail git symbolic-ref -q HEAD >/dev/null
 }

 check_not_detached () {
	git symbolic-ref -q HEAD >/dev/null
 }

and add some more paranoid tests:

 test_expect_success 'checkout --detach without branch name detaches' '
        reset &&
	git checkout --detach &&
	check_detached
 '

 test_expect_success 'checkout --detach catches error in usage' '
	reset &&
	git checkout master &&
	test_must_fail git checkout --detach tag nonsense &&
	check_not_detached
 '

 test_expect_success 'checkout --detach moves HEAD' '
	reset &&
	git checkout one &&
	git checkout --detach two &&
	git diff --exit-code HEAD &&
	git diff --exit-code two
 '

  reply	other threads:[~2011-02-08  0:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 11:01 [1.8.0] git checkout refs/heads/foo checks out branch foo Martin von Zweigbergk
2011-02-07 20:53 ` Junio C Hamano
2011-02-07 20:59 ` Jeff King
2011-02-07 21:36   ` Sverre Rabbelier
2011-02-07 22:00     ` Jonathan Nieder
2011-02-07 23:37       ` Junio C Hamano
2011-02-07 23:45         ` Jeff King
2011-02-08  0:01           ` Jonathan Nieder [this message]
2011-02-08  0:28             ` Jeff King
2011-02-08  0:31           ` Martin von Zweigbergk
2011-02-08  0:52           ` [PATCH/WIP] checkout: introduce --detach synonym for "git checkout foo^{commit}" Jonathan Nieder
2011-02-08  0:55             ` Jonathan Nieder
2011-02-08 10:26             ` [PATCH v2 0/3] " Jonathan Nieder
2011-02-08 10:29               ` [PATCH 1/3] checkout: split off a function to peel away branchname arg Jonathan Nieder
2011-02-08 10:32               ` [PATCH 2/3] checkout: introduce --detach synonym for "git checkout foo^{commit}" Jonathan Nieder
2011-02-08 10:34               ` [PATCH 3/3] checkout: rearrange update_refs_for_switch for clarity Jonathan Nieder
2011-02-07 21:11 ` [1.8.0] git checkout refs/heads/foo checks out branch foo Heiko Voigt
2011-02-08  0:22   ` Martin von Zweigbergk

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=20110208000151.GA19944@elie \
    --to=jrnieder@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=martin.von.zweigbergk@gmail.com \
    --cc=peff@peff.net \
    --cc=srabbelier@gmail.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).