diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2015-07-24 23:05:16 +0300 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2015-07-24 23:05:16 +0300 |
commit | 2dfd5eae33e079bc92a15ccfd561901ea7b69e45 (patch) | |
tree | 9ffd9710483898fa66ac9da05159b1264b147032 /tests | |
parent | 759b2230a522df47640808cb0b21346cc824f6ff (diff) | |
parent | a58854a0311316a66fda363e83665ab942d81ec6 (diff) |
Merge pull request #3307 from libgit2/cmn/submodule-backslash
Normalize submodule urls before looking at them
Diffstat (limited to 'tests')
-rw-r--r-- | tests/submodule/lookup.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/submodule/lookup.c b/tests/submodule/lookup.c index 9b2b3aa19..ecea694e5 100644 --- a/tests/submodule/lookup.c +++ b/tests/submodule/lookup.c @@ -151,6 +151,29 @@ void test_submodule_lookup__lookup_even_with_missing_index(void) test_submodule_lookup__simple_lookup(); /* baseline should still pass */ } +void test_submodule_lookup__backslashes(void) +{ + git_config *cfg; + git_submodule *sm; + git_repository *subrepo; + git_buf buf = GIT_BUF_INIT; + const char *backslashed_path = "..\\submod2_target"; + + cl_git_pass(git_config_open_ondisk(&cfg, "submod2/.gitmodules")); + cl_git_pass(git_config_set_string(cfg, "submodule.sm_unchanged.url", backslashed_path)); + git_config_free(cfg); + + cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_unchanged")); + cl_assert_equal_s(backslashed_path, git_submodule_url(sm)); + cl_git_pass(git_submodule_open(&subrepo, sm)); + + cl_git_pass(git_submodule_resolve_url(&buf, g_repo, backslashed_path)); + + git_buf_free(&buf); + git_submodule_free(sm); + git_repository_free(subrepo); +} + static void baseline_tests(void) { /* small baseline that should work even if we change the index or make |