Commit e476e7beba01efc496ba880f463a8ac61f948270

Edward Thomson 2014-12-18T12:41:59

index tests: test capitalization before mkdir

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/tests/index/tests.c b/tests/index/tests.c
index e9e0a08..42f4483 100644
--- a/tests/index/tests.c
+++ b/tests/index/tests.c
@@ -340,8 +340,10 @@ void test_index_tests__add_invalid_filename(void)
 	cl_must_pass(p_mkdir("./invalid/subdir", 0777));
 
 	/* cl_git_mkfile() needs the dir to exist */
-	cl_must_pass(p_mkdir("./invalid/.GIT", 0777));
-	cl_must_pass(p_mkdir("./invalid/.GiT", 0777));
+	if (!git_path_exists("./invalid/.GIT"))
+		cl_must_pass(p_mkdir("./invalid/.GIT", 0777));
+	if (!git_path_exists("./invalid/.GiT"))
+		cl_must_pass(p_mkdir("./invalid/.GiT", 0777));
 
 	add_invalid_filename(repo, ".git/hello");
 	add_invalid_filename(repo, ".GIT/hello");