From: Nguyen Thai Ngoc Duy Date: Thu, 06 Oct 2011 02:59:12 GMT Subject: Re: [PATCHv3 3/5] Add a common is_gitfile function Message-ID: In-Reply-To: <4E8C5CC2.4030505@cisco.com> On Thu, Oct 6, 2011 at 12:33 AM, Phil Hord wrote: > diff --git a/setup.c b/setup.c > index 61c22e6..a3d5a41 100644 > --- a/setup.c > +++ b/setup.c > @@ -358,7 +358,7 @@ const char *read_gitfile(const char *path) > >        if (stat(path, &st)) >                return NULL; > -       if (!S_ISREG(st.st_mode)) > +       if (!is_gitfile(path)) >                return NULL; >        fd = open(path, O_RDONLY); >        if (fd < 0) > @@ -368,9 +368,6 @@ const char *read_gitfile(const char *path) >        close(fd); >        if (len != st.st_size) >                die("Error reading %s", path); > -       buf[len] = '\0'; > -       if (prefixcmp(buf, "gitdir: ")) > -               die("Invalid gitfile format: %s", path); >        while (buf[len - 1] == '\n' || buf[len - 1] == '\r') >                len--; >        if (len < 9) I think you are changing the behavior here. Currently if .git is a file and not a valid gitfile, die() will be called and repo discovery process stops. With your patch, it skips invalid .git files and moves on. I'm not saying it's good or bad, just pointing out. -- Duy