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

unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem)

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 3, 2011, 03:59 UTC
Message-ID
<20111003035907.GA17134@elie>
In-Reply-To
<4E892483.7070605@lwfinger.net>
Hi,
Larry Finger wrote:
Show 7 quoted lines
> I had my system freeze when doing a pull from Linus's repo. Since then,
> every pull results in the following errors:
>
> ~> git pull
> error: unable to resolve reference refs/tags/v3.1-rc8: Success
> From git://github.com/torvalds/linux
>  ! [new tag]         v3.1-rc8   -> v3.1-rc8  (unable to update local ref)

Could you try pulling again with "/path/to/git/sources/bin-wrappers/git pull" after applying this patch?

Thanks,
diff --git i/refs.c w/refs.c
index a615043b..b15f78a4 100644
--- i/refs.c
+++ w/refs.c
@@ -493,12 +493,15 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
 		char *buf;
 		int fd;
 
-		if (--depth < 0)
+		if (--depth < 0) {
+			errno = ELOOP;
 			return NULL;
+		}
 
 		git_snpath(path, sizeof(path), "%s", ref);
 		/* Special case: non-existing file. */
 		if (lstat(path, &st) < 0) {
+			int saved_errno = errno;
 			struct ref_list *list = get_packed_refs(NULL);
 			while (list) {
 				if (!strcmp(ref, list->name)) {
@@ -509,6 +512,7 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
 				}
 				list = list->next;
 			}
+			errno = saved_errno;
 			if (reading || errno != ENOENT)
 				return NULL;
 			hashclr(sha1);
@@ -562,7 +566,8 @@ const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int *
 			*flag |= REF_ISSYMREF;
 	}
 	if (len < 40 || get_sha1_hex(buffer, sha1))
-		return NULL;
+		die("ref %s is corrupt: length=%d, content=%.*s", ref,
+		    (int) len, (int) len, buffer);
 	return ref;
 }
 
Next: Larry Finger
Message 1 of 4 in “unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem)”
  1. Jonathan NiederOct 3, 2011
  2. Larry FingerOct 3, 2011
  3. Jonathan NiederOct 3, 2011
  4. Larry FingerOct 3, 2011

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.