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

Re: Re* [PATCH 1/2] clone: allow to clone from .git file

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
Aug 23, 2011, 01:11 UTC
Message-ID
<CACsJy8ABBB69V3pFjGohJwAQbZ_MwGqv=p27tUHF8HAGRMLpQw@mail.gmail.com>
In-Reply-To
<7vty99upn9.fsf_-_@alter.siamese.dyndns.org>
On Tue, Aug 23, 2011 at 4:01 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 8 quoted lines
> -const char *read_gitfile_gently(const char *path)
> +const char *read_gitfile_gently(const char *path, int *status)
>  {
>        char *buf;
>        char *dir;
> @@ -389,20 +391,39 @@ const char *read_gitfile_gently(const char *path)
>        if (!S_ISREG(st.st_mode))
>                return NULL;
Set *status here too? I assume we need valid *status whenever NULL is returned.
Show 12 quoted lines
>        fd = open(path, O_RDONLY);
> -       if (fd < 0)
> -               die_errno("Error opening '%s'", path);
> +       if (fd < 0) {
> +               if (!status)
> +                       die_errno("Error opening '%s'", path);
> +               *status = ERROR_READ_GITFILE_CANTOPEN;
> +               return NULL;
> +       }
>        buf = xmalloc(st.st_size + 1);
>        len = read_in_full(fd, buf, st.st_size);
>        close(fd);
-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 of 9 in “clone: allow to clone from .git file”
  1. 1/2 clone: allow to clone from .git fileNguyễn Thái Ngọc Duy, Aug 21, 2011
  2. 2/2 Do not accept NUL in the path in .git fileNguyễn Thái Ngọc Duy, Aug 21, 2011
  3. Junio C HamanoAug 21, 2011
  4. Nguyen Thai Ngoc DuyAug 22, 2011
  5. Junio C HamanoAug 22, 2011
  6. Re* [PATCH 1/2] clone: allow to clone from .git fileJunio C Hamano, Aug 22, 2011
  7. Nguyen Thai Ngoc DuyAug 23, 2011
  8. Junio C HamanoAug 23, 2011
  9. Nguyen Thai Ngoc DuyAug 23, 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.