git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] checkout: do not corrupt HEAD on empty repo

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2012, 16:43 UTC
Message-ID
<7vsjfawrmw.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CABPQNSau5snkNLqsnBnsLVBVNKHXnvb8rsE8DbNfpo9__5uijA@mail.gmail.com>
Erik Faye-Lund <kusmabite@gmail.com> writes:
Show 18 quoted lines
> 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. Perhaps it would make it more palatable if you replaced "cat .git/HEAD" with "git symbolic-ref HEAD" in the original?

Previous: Erik Faye-LundNext: Erik Faye-Lund
Message 3 of 10 in “checkout: do not corrupt HEAD on empty repo”
  1. checkout: do not corrupt HEAD on empty repoErik Faye-Lund, May 8, 2012
  2. Erik Faye-LundMay 8, 2012
  3. Junio C HamanoMay 8, 2012
  4. Erik Faye-LundMay 8, 2012
  5. Junio C HamanoMay 8, 2012
  6. Junio C HamanoMay 8, 2012
  7. Erik Faye-LundMay 8, 2012
  8. Junio C HamanoMay 8, 2012
  9. Erik Faye-LundMay 8, 2012
  10. Andreas SchwabMay 8, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.