On Wed, Oct 5, 2011 at 7:08 AM, Phil Hord <phil.hord@xxxxxxxxx> wrote: > +static int is_gitfile(const char *url) > +{ > + struct stat st; > + char buf[9]; > + int fd, len; > + if (stat(url, &st)) > + return 0; > + if (!S_ISREG(st.st_mode)) > + return 0; > + if (st.st_size < 10 || st.st_size > PATH_MAX) > + return 1; > + > + fd = open(url, O_RDONLY); > + if (fd < 0) > + die_errno("Error opening '%s'", url); > + len = read_in_full(fd, buf, sizeof(buf)); > + close(fd); > + if (len != sizeof(buf)) > + die("Error reading %s", url); > + return !prefixcmp(buf, "gitdir: "); > +} > + There's similar code in get_repo_path(), builtin/clone.c, added in commit 9b0ebc7 (clone: allow to clone from .git file). Perhaps you can reuse this function there and remove duplicate code. -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html