public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* git problem
@ 2011-10-03  2:57 Larry Finger
  2011-10-03  3:59 ` unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem) Jonathan Nieder
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2011-10-03  2:57 UTC (permalink / raw)
  To: LKML

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem)
  2011-10-03  2:57 git problem Larry Finger
@ 2011-10-03  3:59 ` Jonathan Nieder
  2011-10-03  4:15   ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2011-10-03  3:59 UTC (permalink / raw)
  To: Larry Finger; +Cc: LKML, git

Hi,

Larry Finger wrote:

> 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;
 }
 

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem)
  2011-10-03  3:59 ` unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem) Jonathan Nieder
@ 2011-10-03  4:15   ` Larry Finger
  2011-10-03  4:40     ` unable to resolve reference refs/tags/v3.1-rc8: Success Jonathan Nieder
  0 siblings, 1 reply; 5+ messages in thread
From: Larry Finger @ 2011-10-03  4:15 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: LKML, git

On 10/02/2011 10:59 PM, Jonathan Nieder wrote:
> Hi,
>
> Larry Finger wrote:
>
>> 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;
>   }

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unable to resolve reference refs/tags/v3.1-rc8: Success
  2011-10-03  4:15   ` Larry Finger
@ 2011-10-03  4:40     ` Jonathan Nieder
  2011-10-03  5:11       ` Larry Finger
  0 siblings, 1 reply; 5+ messages in thread
From: Jonathan Nieder @ 2011-10-03  4:40 UTC (permalink / raw)
  To: Larry Finger; +Cc: LKML, git

Larry Finger wrote:

> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: unable to resolve reference refs/tags/v3.1-rc8: Success
  2011-10-03  4:40     ` unable to resolve reference refs/tags/v3.1-rc8: Success Jonathan Nieder
@ 2011-10-03  5:11       ` Larry Finger
  0 siblings, 0 replies; 5+ messages in thread
From: Larry Finger @ 2011-10-03  5:11 UTC (permalink / raw)
  To: Jonathan Nieder; +Cc: LKML, git

On 10/02/2011 11:40 PM, Jonathan Nieder wrote:
> Larry Finger wrote:
>
>> 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.

Thanks. That did the trick.

Larry


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-03  5:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-03  2:57 git problem Larry Finger
2011-10-03  3:59 ` unable to resolve reference refs/tags/v3.1-rc8: Success (Re: git problem) Jonathan Nieder
2011-10-03  4:15   ` Larry Finger
2011-10-03  4:40     ` unable to resolve reference refs/tags/v3.1-rc8: Success Jonathan Nieder
2011-10-03  5:11       ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox