git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Jon Seymour <jon.seymour@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>
Subject: [PATCH] fetch: do not create ref from empty name
Date: Wed, 17 Jun 2009 15:38:36 +0200	[thread overview]
Message-ID: <20090617133836.GA25155@localhost> (raw)
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

      reply	other threads:[~2009-06-17 13:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-17 12:08 error: * Ignoring funny ref 'refs/heads/' locally Jon Seymour
2009-06-17 13:38 ` Clemens Buchacher [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090617133836.GA25155@localhost \
    --to=drizzd@aon.at \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jon.seymour@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).