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

Re: bug report? fatal: Ambiguous object name: 'xxx' during branch operation

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 6, 2012, 23:44 UTC
Message-ID
<7vvcmhpa66.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAB1hNr8-iPbXD-7eEOxZtrJWO78V8sDmwWWQRMMExvtGtpPrhw@mail.gmail.com>
Arya Irani <arya.irani@gmail.com> writes:
> If the default start-point for a branch is HEAD, then how can it fail
> due to ambiguity?

The whole create_branch() codepath is a mess and needs to be cleaned up, but in the shorter term, something like this, perhaps?

 builtin/branch.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index d8cccf7..02d0653 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -807,7 +807,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 	} else if (argc > 0 && argc <= 2) {
 		if (kinds != REF_LOCAL_BRANCH)
 			die(_("-a and -r options to 'git branch' do not make sense with a branch name"));
-		create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
+		create_branch(head, argv[0], (argc == 2) ? argv[1] : "HEAD",
 			      force_create, reflog, 0, track);
 	} else
 		usage_with_options(builtin_branch_usage, options);
Previous: Arya Irani
Message 2 of 2 in “bug report? fatal: Ambiguous object name: 'xxx' during branch operation”
  1. Arya IraniMar 6, 2012
  2. Junio C HamanoMar 6, 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.