@@ -136,19 +136,21 @@ void test_submodule_add__path_exists_in_index(void)
136136 git_buf dirname = GIT_BUF_INIT ;
137137 git_buf filename = GIT_BUF_INIT ;
138138
139- /* In this repo, HEAD (master) has no remote tracking branc h*/
140139 g_repo = cl_git_sandbox_init ("testrepo" );
141140
142- cl_git_pass (git_buf_joinpath (& dirname , git_repository_workdir (g_repo ), "TestGitRepository " ));
141+ cl_git_pass (git_buf_joinpath (& dirname , git_repository_workdir (g_repo ), "subdirectory " ));
143142 cl_git_pass (git_buf_joinpath (& filename , dirname .ptr , "test.txt" ));
144143
145144 cl_git_pass (p_mkdir (dirname .ptr , 0700 ));
146145 cl_git_mkfile (filename .ptr , "This is some content" );
147146
148147 cl_git_pass (git_repository_index__weakptr (& index , g_repo ));
149- cl_git_pass (git_index_add_bypath (index , "TestGitRepository/test.txt" ));
148+ cl_git_pass (git_index_add_bypath (index , "subdirectory/test.txt" ));
149+
150+ cl_git_pass (p_unlink (filename .ptr ));
151+ cl_git_pass (p_rmdir (dirname .ptr ));
150152
151- cl_git_fail_with (git_submodule_add_setup (& sm , g_repo , "./" , "TestGitRepository " , 1 ), GIT_EEXISTS );
153+ cl_git_fail_with (git_submodule_add_setup (& sm , g_repo , "./" , "subdirectory " , 1 ), GIT_EEXISTS );
152154
153155 git_submodule_free (sm );
154156 git_buf_free (& dirname );
@@ -161,17 +163,18 @@ void test_submodule_add__file_exists_in_index(void)
161163 git_submodule * sm ;
162164 git_buf name = GIT_BUF_INIT ;
163165
164- /* In this repo, HEAD (master) has no remote tracking branc h*/
165166 g_repo = cl_git_sandbox_init ("testrepo" );
166167
167- cl_git_pass (git_buf_joinpath (& name , git_repository_workdir (g_repo ), "TestGitRepository " ));
168+ cl_git_pass (git_buf_joinpath (& name , git_repository_workdir (g_repo ), "subdirectory " ));
168169
169170 cl_git_mkfile (name .ptr , "Test content" );
170171
171172 cl_git_pass (git_repository_index__weakptr (& index , g_repo ));
172- cl_git_pass (git_index_add_bypath (index , "TestGitRepository" ));
173+ cl_git_pass (git_index_add_bypath (index , "subdirectory" ));
174+
175+ cl_git_pass (p_unlink (name .ptr ));
173176
174- cl_git_fail_with (git_submodule_add_setup (& sm , g_repo , "./" , "TestGitRepository " , 1 ), GIT_EEXISTS );
177+ cl_git_fail_with (git_submodule_add_setup (& sm , g_repo , "./" , "subdirectory " , 1 ), GIT_EEXISTS );
175178
176179 git_submodule_free (sm );
177180 git_buf_free (& name );
0 commit comments