[PATCH] Fix symbolic ref validation
Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote Wed, Oct 05, 2005:
> Hi,
Show 12 quoted lines
> 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