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

[Discuss] soften warning message after cloning "void"

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 18, 2015, 23:24 UTC
Message-ID
<xmqqh9ui2481.fsf@gitster.dls.corp.google.com>
If you did this:
    $ git init void &&
      git -C void commit --allow-empty -m initial &&
      git -C void symbolic-ref HEAD refs/heads/nosuch
    $ git clone --no-local void new
you would get
    warning: remote HEAD refers to nonexistent ref, unable to checkout.

While it is correct that we are unable to perform the normal "checkout" of their primary branch that their HEAD points at, it was reported that some users find this message unnecessarily alarming.

Rephrase by saying what we decided to do, instead of only stating what led us to that decision without telling what that decision is. That is, "(because we cannot checkout), we left the HEAD pointing at an unborn branch."

---
 builtin/clone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 9572467..c7f1bf2 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -625,8 +625,8 @@ static int checkout(void)
 
 	head = resolve_refdup("HEAD", RESOLVE_REF_READING, sha1, NULL);
 	if (!head) {
-		warning(_("remote HEAD refers to nonexistent ref, "
-			  "unable to checkout.\n"));
+		warning(_("remote HEAD refers to nonexistent ref; "
+			  "leaving the current branch unborn.\n"));
 		return 0;
 	}
 	if (!strcmp(head, "HEAD")) {
Next: Stefan Beller
Message 1 of 9 in “[Discuss] soften warning message after cloning "void"”
  1. Junio C HamanoFeb 18, 2015
  2. Stefan BellerFeb 19, 2015
  3. Junio C HamanoFeb 19, 2015
  4. Shawn PearceFeb 19, 2015
  5. Shawn PearceFeb 19, 2015
  6. Junio C HamanoFeb 19, 2015
  7. Stefan BellerFeb 19, 2015
  8. Junio C HamanoFeb 21, 2015
  9. Stefan BellerFeb 19, 2015

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.