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
This commit is contained in:
@ -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;
|
||||
|
Reference in New Issue
Block a user