git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Oct 6, 2011, 02:59 UTC
Message-ID
<CACsJy8C1yHYn8b85ia5SB9UfRBrpMT=xYkSmN4EjOoKP3xx_6w@mail.gmail.com>
In-Reply-To
<4E8C5CC2.4030505@cisco.com>
On Thu, Oct 6, 2011 at 12:33 AM, Phil Hord <hordp@cisco.com> wrote:
Show 23 quoted lines
> 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
Previous: Phil Hord
Message 2 of 2 in “[PATCHv3 3/5] Add a common is_gitfile function”
  1. Phil HordOct 5, 2011
  2. Nguyen Thai Ngoc DuyOct 6, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.