Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2023-04-21 00:33:36 +0300
committerJunio C Hamano <gitster@pobox.com>2023-04-21 00:33:36 +0300
commita4a4db8cf7024b31ecd4b2c59cdcac41e81c91a2 (patch)
tree708c8bd597b1bc45bcc5a68d7355c1843163a476 /builtin/clone.c
parent98c496fcd09b5894966f3e499217eb2bdf8b964d (diff)
parent4e33535ea98ac16d2163e8e9fcbba5e015881e65 (diff)
Merge branch 'gc/better-error-when-local-clone-fails-with-symlink'
"git clone --local" stops copying from an original repository that has symbolic links inside its $GIT_DIR; an error message when that happens has been updated. * gc/better-error-when-local-clone-fails-with-symlink: clone: error specifically with --local and symlinked objects
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 6dc89f1058..eeec8067ec 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -331,8 +331,18 @@ 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) && S_ISLNK(st.st_mode))
+ die(_("'%s' is a symlink, refusing to clone with --local"),
+ src->buf);
+ errno = saved_errno;
+ }
die_errno(_("failed to start iterator over '%s'"), src->buf);
+ }
strbuf_addch(src, '/');
src_len = src->len;