Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

Re: [PATCHv3 3/5] Add a common is_gitfile function

From: Nguyen Thai Ngoc Duy <hidden>
Date: 2016-06-15 22:52:11

On Thu, Oct 6, 2011 at 12:33 AM, Phil Hord [off-list ref] wrote:
quoted hunk ↗ jump to hunk
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help