Skip to content

Commit 630e05c

Browse files
committed
Merge branch 'jk/clone-copy-alternates-fix'
"git clone" of a local repository can be done at the filesystem level, but the codepath did not check errors while copying and adjusting the file that lists alternate object stores. * jk/clone-copy-alternates-fix: clone: detect errors in normalize_path_copy
2 parents c6400bf + 22d3b8d commit 630e05c

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

builtin/clone.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,11 @@ static void copy_alternates(struct strbuf *src, struct strbuf *dst,
351351
continue;
352352
}
353353
abs_path = mkpathdup("%s/objects/%s", src_repo, line.buf);
354-
normalize_path_copy(abs_path, abs_path);
355-
add_to_alternates_file(abs_path);
354+
if (!normalize_path_copy(abs_path, abs_path))
355+
add_to_alternates_file(abs_path);
356+
else
357+
warning("skipping invalid relative alternate: %s/%s",
358+
src_repo, line.buf);
356359
free(abs_path);
357360
}
358361
strbuf_release(&line);

0 commit comments

Comments
 (0)