summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-03-28 16:33:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-03-28 16:33:09 (GMT)
commit73d8bfde32acae522b305f7742350d392e3f4e86 (patch)
tree586fa45f15183abe364dc8ebc63fcc50c98188b6 /builtin/clone.c
parent591a1daa7cdfd40ce76d0afcca05a7a648e73f3d (diff)
parent16eff6c009c0af430975d44c0af98262f1edb549 (diff)
downloadgit-73d8bfde32acae522b305f7742350d392e3f4e86.zip
git-73d8bfde32acae522b305f7742350d392e3f4e86.tar.gz
git-73d8bfde32acae522b305f7742350d392e3f4e86.tar.bz2
Merge branch 'jk/cleanup-failed-clone' into maint
An failure early in the "git clone" that started creating the working tree and repository could have resulted in some directories and files left without getting cleaned up. * jk/cleanup-failed-clone: clone: drop period from end of die_errno message clone: initialize atexit cleanup handler earlier
Diffstat (limited to 'builtin/clone.c')
-rw-r--r--builtin/clone.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/builtin/clone.c b/builtin/clone.c
index 316c75d..2d77a2d 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -842,20 +842,21 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
git_dir = mkpathdup("%s/.git", dir);
}
+ atexit(remove_junk);
+ sigchain_push_common(remove_junk_on_signal);
+
if (!option_bare) {
- junk_work_tree = work_tree;
if (safe_create_leading_directories_const(work_tree) < 0)
die_errno(_("could not create leading directories of '%s'"),
work_tree);
if (!dest_exists && mkdir(work_tree, 0777))
- die_errno(_("could not create work tree dir '%s'."),
+ die_errno(_("could not create work tree dir '%s'"),
work_tree);
+ junk_work_tree = work_tree;
set_git_work_tree(work_tree);
}
- junk_git_dir = git_dir;
- atexit(remove_junk);
- sigchain_push_common(remove_junk_on_signal);
+ junk_git_dir = git_dir;
if (safe_create_leading_directories_const(git_dir) < 0)
die(_("could not create leading directories of '%s'"), git_dir);