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

[PATCH] fetch: do not create ref from empty name

From
Clemens Buchacher <drizzd@aon.at>
Date
Jun 17, 2009, 13:38 UTC
Message-ID
<20090617133836.GA25155@localhost>
In-Reply-To
<2cfc40320906170508o4fc0fc14sca511742be03ee5@mail.gmail.com>

Previously, the refspec "<src>:" would be expanded to "<src>:refs/heads/". Instead, treat an empty <dst> just like refspecs without a colon.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
---
On Wed, Jun 17, 2009 at 10:08:25PM +1000, Jon Seymour wrote:
> Can someone tell me why this happens?
> 
>     error: * Ignoring funny ref 'refs/heads/' locally
This fixes it.

Note that "git fetch origin :" is short for "git fetch origin HEAD", which stores the remote HEAD in FETCH_HEAD. You probably want "git fetch origin", without an explicit refspec, which defaults to "git fetch origin 'refs/heads/*:refs/remotes/origin/*'", i.e. store remote branches in the namespace for tracking branches.

Clemens
 remote.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/remote.c b/remote.c
index 08a5964..99e7797 100644
--- a/remote.c
+++ b/remote.c
@@ -1263,7 +1263,7 @@ struct ref *get_remote_ref(const struct ref *remote_refs, const char *name)
 
 static struct ref *get_local_ref(const char *name)
 {
-	if (!name)
+	if (!name || name[0] == '\0')
 		return NULL;
 
 	if (!prefixcmp(name, "refs/"))
-- 
1.6.3.1.147.g637c3
Previous: Jon Seymour
Message 2 of 2 in “error: * Ignoring funny ref 'refs/heads/' locally”
  1. Jon SeymourJun 17, 2009
  2. fetch: do not create ref from empty nameClemens Buchacher, Jun 17, 2009

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.