Re: [PATCH] checkout: do not corrupt HEAD on empty repo
- From
Junio C Hamano <gitster@pobox.com>
- Date
- May 8, 2012, 17:13 UTC
- Message-ID
- <7v8vh2wq8u.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CABPQNSbyh8oMfz8GbDDn_bdLc8RpEt5sq7wxtVFh61ekD_j8yQ@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
Show 14 quoted lines
> On Tue, May 8, 2012 at 6:43 PM, Junio C Hamano <gitster@pobox.com> wrote:
> ...
>> 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")...Surely.
By the way, notice I said "we *may* want checkout to fail"? With the discussion "why is it wrong to allow 'git checkout' to be no-op in a freshly created repository" stemming from your other "I do not claim it is correct but it makes the test pass" message, we may actually want to make that 'checkout' in the test pass, and then 'test_must_fail git checkout' in the test would have to go when that happens.