On Tue, Jan 2, 2018 at 4:11 PM, Jeff King <peff@xxxxxxxx> wrote: > [...] > Because we know that the only directory we'll write into is > an empty one, we can handle this case by just passing the > KEEP_TOPLEVEL flag to our recursive delete (if we could > write into populated directories, we'd have to keep track of > what we wrote and what we did not, which would be much > harder). > > Note that we need to handle the work-tree and git-dir > separately, though, as only one might exist (and the new > tests in t5600 cover all cases). > > Reported-by: Stephan Janssen <sjanssen@xxxxxxxxxxx> > Signed-off-by: Jeff King <peff@xxxxxxxx> > --- > diff --git a/t/t5600-clone-fail-cleanup.sh b/t/t5600-clone-fail-cleanup.sh > @@ -42,13 +53,48 @@ test_expect_success 'successful clone must leave the directory' ' > +test_expect_success 'failed clone into empty leaves directory (separate, git)' ' > + mkdir -p empty-git && > + corrupt_repo && > + test_must_fail git clone --separate-git-dir empty-git foo no-wt && > + test_dir_is_empty empty-git && > + test_path_is_missing no-wt > +' > + > +test_expect_success 'failed clone into empty leaves directory (separate, git)' ' > + mkdir -p empty-wt && > + corrupt_repo && > + test_must_fail git clone --separate-git-dir no-git foo empty-wt && > + test_path_is_missing no-git && > + test_dir_is_empty empty-wt > +' The final two tests seem to have the same title...