Skip to content

Commit

Permalink
Merge branch 'jk/cleanup-failed-clone' into maint
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Junio C Hamano committed Mar 28, 2015
2 parents 591a1da + 16eff6c commit 73d8bfd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions builtin/clone.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 73d8bfd

Please sign in to comment.