From: Jonas Fonseca Date: Wed, 05 Oct 2005 15:52:12 GMT Subject: [PATCH] Fix symbolic ref validation Message-ID: <20051005155212.GA16391@diku.dk> In-Reply-To: Johannes Schindelin 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 --- 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