[PATCH] Fix symbolic ref validation

From: Jonas Fonseca <fonseca@diku.dk>
Date: 2005-10-06 01:52:12
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote Wed, Oct 05, 2005:
> Hi,

Hello,

> On Wed, 5 Oct 2005, Jonas Fonseca wrote:
> 
> >   user@machine /usr/local/dev/git/git
> >   $ git-log
> >   fatal: Not a git repository
> > 
> >   user@machine /usr/local/dev/git/git
> >   $ GIT_DIR=.git git-log | wc -l
> >   26094
> 
> That could have its cause in your .git/HEAD being no symlink. That happens 
> when rsync´ing the .git directory.

Yes, used rsync when I cloned. Seems validate_symref() was buggy. 

> The other errors could also stem from the fact that quite a few places 
> expect HEAD to be a symlink.

git-reset still error out ...

---

Use the correct buffer when validating 'ref: refs/...'

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
diff --git a/refs.c b/refs.c
--- a/refs.c
+++ b/refs.c
@@ -46,7 +46,7 @@ int validate_symref(const char *path)
 	len -= 4;
 	while (len && isspace(*buf))
 		buf++, len--;
-	if (len >= 5 && !memcmp("refs/", buffer, 5))
+	if (len >= 5 && !memcmp("refs/", buf, 5))
 		return 0;
 	return -1;
 }

-- 
Jonas Fonseca
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Thu Oct 06 01:52:47 2005

This archive was generated by hypermail 2.1.8 : 2005-10-06 01:52:50 EST