提交 fdabc242 编写于 作者: D Daniel Barkalow 提交者: Junio C Hamano

clone: fall back to copying if hardlinking fails

Note that it stops trying hardlinks if any fail.
Signed-off-by: NDaniel Barkalow <barkalow@iabervon.org>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 689ef4d4
......@@ -207,13 +207,15 @@ static void copy_or_link_directory(char *src, char *dest)
if (unlink(dest) && errno != ENOENT)
die("failed to unlink %s\n", dest);
if (option_no_hardlinks) {
if (copy_file(dest, src, 0666))
die("failed to copy file to %s\n", dest);
} else {
if (link(src, dest))
if (!option_no_hardlinks) {
if (!link(src, dest))
continue;
if (option_local)
die("failed to create link %s\n", dest);
option_no_hardlinks = 1;
}
if (copy_file(dest, src, 0666))
die("failed to copy file to %s\n", dest);
}
closedir(dir);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册