Skip to contentSkip to conversation

git problem

DISCUSSION Larry Finger 2 participants 5 messages Oct 3, 2011

lore
Share & tools
lore
#0 lore raw

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)

Any suggestions on how to fix this error?

Thanks,

Larry

#1 lore raw

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

Hi,

Quoted 7 lines · Larry Finger

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,

refs.c +7 -2
index a615043b..b15f78a4 100644
@@ -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;
 }
 
#2 lore raw

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

Quoted 48 lines · Jonathan Nieder

Hi,

Quoted 7 lines · Larry Finger

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,

refs.c +5 -1
index a615043b..b15f78a4 100644
@@ -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);

refs.c const char *resolve_ref(const char *ref, unsigned char *sha1, int reading, int * · line 572

Quoted 8 lines
refs.c +2 -1
@@ -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;
  }

After applying that patch, I get

finger@larrylap:~/linux-2.6> ~/git/git pull
fatal: ref refs/tags/v3.1-rc8 is corrupt: length=41, content=

Larry

#3 lore raw

Re: unable to resolve reference refs/tags/v3.1-rc8: Success

Quoted 4 lines · Larry Finger

After applying that patch, I get

finger@larrylap:~/linux-2.6> ~/git/git pull
fatal: ref refs/tags/v3.1-rc8 is corrupt: length=41, content=

Great, thanks.

In the short term I'd suggest just removing the corrupt .git/refs/tags/v3.1-rc8 file with "rm" so it can be fetched again. Hopefully later tonight I can prepare a real patch to fix this, though I wouldn't mind if someone else takes care of it first.

#4 lore raw

Re: unable to resolve reference refs/tags/v3.1-rc8: Success

Quoted 7 lines · Jonathan Nieder
Quoted 4 lines · Larry Finger

After applying that patch, I get

finger@larrylap:~/linux-2.6> ~/git/git pull
fatal: ref refs/tags/v3.1-rc8 is corrupt: length=41, content=

Quoted 6 lines

Great, thanks.

In the short term I'd suggest just removing the corrupt .git/refs/tags/v3.1-rc8 file with "rm" so it can be fetched again. Hopefully later tonight I can prepare a real patch to fix this, though I wouldn't mind if someone else takes care of it first.

Thanks. That did the trick.

Larry