Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a89a756

Browse files
committed
submodule: add failing test for backslash in url
1 parent 38dc994 commit a89a756

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/submodule/lookup.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,29 @@ void test_submodule_lookup__lookup_even_with_missing_index(void)
151151
test_submodule_lookup__simple_lookup(); /* baseline should still pass */
152152
}
153153

154+
void test_submodule_lookup__backslashes(void)
155+
{
156+
git_config *cfg;
157+
git_submodule *sm;
158+
git_repository *subrepo;
159+
git_buf buf = GIT_BUF_INIT;
160+
const char *backslashed_path = "..\\submod2_target";
161+
162+
cl_git_pass(git_config_open_ondisk(&cfg, "submod2/.gitmodules"));
163+
cl_git_pass(git_config_set_string(cfg, "submodule.sm_unchanged.url", backslashed_path));
164+
git_config_free(cfg);
165+
166+
cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_unchanged"));
167+
cl_assert_equal_s(backslashed_path, git_submodule_url(sm));
168+
cl_git_pass(git_submodule_open(&subrepo, sm));
169+
170+
cl_git_pass(git_submodule_resolve_url(&buf, g_repo, backslashed_path));
171+
172+
git_buf_free(&buf);
173+
git_submodule_free(sm);
174+
git_repository_free(subrepo);
175+
}
176+
154177
static void baseline_tests(void)
155178
{
156179
/* small baseline that should work even if we change the index or make

0 commit comments

Comments
 (0)