Re: [PATCH v2] clone: error specifically with --local and symlinked objects
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Apr 11, 2023, 01:58 UTC
- Message-ID
- <ZDS+zJAilFqxMSqa@nand.local>
- In-Reply-To
- <pull.1488.v2.git.git.1681165130765.gitgitgadget@gmail.com>
On Mon, Apr 10, 2023 at 10:18:50PM +0000, Glen Choo via GitGitGadget wrote:
Show 14 quoted lines
> diff --git a/builtin/clone.c b/builtin/clone.c
> index 462c286274c..46f6f689c85 100644
> --- a/builtin/clone.c
> +++ b/builtin/clone.c
> @@ -327,8 +327,17 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest,
>
> iter = dir_iterator_begin(src->buf, DIR_ITERATOR_PEDANTIC);
>
> - if (!iter)
> + if (!iter) {
> + if (errno == ENOTDIR) {
> + int saved_errno = errno;
> + struct stat st;
> + if (lstat(src->buf, &st) == 0 && S_ISLNK(st.st_mode))I missed it on my first read, but you may want to consider "!lstat(...)" instead of "lstat(...) == 0". Probably not worth a reroll, though.
Thanks, Taylor