Merge branch 'maint'
[git/fastimport.git] / t / t5600-clone-fail-cleanup.sh
blob1776b377f3c787977b145980f05aa74da5038657
1 #!/bin/sh
3 # Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>
6 test_description='test git-clone to cleanup after failure
8 This test covers the fact that if git-clone fails, it should remove
9 the directory it created, to avoid the user having to manually
10 remove the directory before attempting a clone again.'
12 . ./test-lib.sh
14 test_expect_failure \
15 'clone of non-existent source should fail' \
16 'git-clone foo bar'
18 test_expect_failure \
19 'failed clone should not leave a directory' \
20 'cd bar'
22 # Need a repo to clone
23 test_create_repo foo
25 # clone doesn't like it if there is no HEAD. Is that a bug?
26 (cd foo && touch file && git add file && git commit -m 'add file' >/dev/null 2>&1)
28 # source repository given to git-clone should be relative to the
29 # current path not to the target dir
30 test_expect_failure \
31 'clone of non-existent (relative to $PWD) source should fail' \
32 'git-clone ../foo baz'
34 test_expect_success \
35 'clone should work now that source exists' \
36 'git-clone foo bar'
38 test_expect_success \
39 'successful clone must leave the directory' \
40 'cd bar'
42 test_done