Re: Re* [PATCH 1/2] clone: allow to clone from .git file
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