Re: [PATCH] checkout: do not corrupt HEAD on empty repo
- From
Erik Faye-Lund <kusmabite@gmail.com>
- Date
- May 8, 2012, 16:52 UTC
- Message-ID
- <CABPQNSbyh8oMfz8GbDDn_bdLc8RpEt5sq7wxtVFh61ekD_j8yQ@mail.gmail.com>
- In-Reply-To
- <7vsjfawrmw.fsf@alter.siamese.dyndns.org>
On Tue, May 8, 2012 at 6:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
> Erik Faye-Lund <kusmabite@gmail.com> writes: > >> Hmh, this is needlessly cluttery. The following should cover it: >> >> --- >> diff --git a/t/t2015-checkout-unborn.sh b/t/t2015-checkout-unborn.sh >> index 2fa9458..b49fedf 100755 >> --- a/t/t2015-checkout-unborn.sh >> +++ b/t/t2015-checkout-unborn.sh >> @@ -50,10 +50,7 @@ test_expect_success 'checking out in a newly created repo' ' >> test_create_repo empty && >> ( >> cd empty && >> - cat .git/HEAD >expect && >> - test_must_fail git checkout && >> - cat .git/HEAD >actual && >> - test_cmp expect actual >> + test_must_fail git checkout >> ) >> ' > > Hrm, I am of two minds. Yes, we may want checkout to fail, but at the > same time, we would want to make sure that a failed checkout does not > corrupt the HEAD.
Good point.
> Perhaps it would make it more palatable if you replaced > "cat .git/HEAD" with "git symbolic-ref HEAD" in the original?
Ah, yes. That's much better. Do you want me to resend (improving the test and replacing "CRT" with "vsnprintf")? I also spotted a typo in the commit message ("crasheed" vs "crashed")...