Re: [1.8.0] git checkout refs/heads/foo checks out branch foo

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
 '
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]