summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Daniel Barkalow <barkalow@iabervon.org>2008-05-20 14:15:14 -0400
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-05-21 11:11:58 -0700
commitfdabc242f465771116e08d1ea3737fdb7453b2f1 (patch)
tree0a544d0b791cf9a53298e5f91ad2e5fd0d28e65c
parentbuiltin-clone.c: Need to closedir() in copy_or_link_directory() (diff)
downloadtgif-fdabc242f465771116e08d1ea3737fdb7453b2f1.tar.xz
clone: fall back to copying if hardlinking fails
Note that it stops trying hardlinks if any fail. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin-clone.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin-clone.c b/builtin-clone.c
index 8936a51810..2a3f6732f2 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -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);
}