New test to verify that when git-clone fails it cleans up the new directory.
Signed-off-by: Carl Worth <cworth@cworth.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Carl Worth committed
Feb 17, 2006 at 13:33 UTC
5508a616631fb41531b638f744bd92c701727014
1 file changed
+36
t/t5600-clone-fail-cleanup.sh
new
+36
@@ -0,0 +1,36 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (C) 2006 Carl D. Worth <cworth@cworth.org>
4
+#
5
+
6
+test_description='test git-clone to cleanup after failure
7
+
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.'
11
+
12
+. ./test-lib.sh
13
+
14
+test_expect_failure \
15
+ 'clone of non-existent source should fail' \
16
+ 'git-clone foo bar'
17
+
18
+test_expect_failure \
19
+ 'failed clone should not leave a directory' \
20
+ 'cd bar'
21
+
22
+# Need a repo to clone
23
+test_create_repo foo
24
+
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)
27
+
28
+test_expect_success \
29
+ 'clone should work now that source exists' \
30
+ 'git-clone foo bar'
31
+
32
+test_expect_success \
33
+ 'successfull clone must leave the directory' \
34
+ 'cd bar'
35
+
36
+test_done