Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-07-13 09:39:35 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-07-13 09:39:35 +0300
commitaa51fa1e03df9a30c8c37b168758dd34dd75f353 (patch)
tree95af9851361a29753c5f1b09f0395c5b8ec17487
parentf861abadfe0f1cc4c1b72312e9dd1c7bb39ea42d (diff)
submodule: add failing test for backslash in url
-rw-r--r--tests/submodule/lookup.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/submodule/lookup.c b/tests/submodule/lookup.c
index 4d40e2279..38f06abbc 100644
--- a/tests/submodule/lookup.c
+++ b/tests/submodule/lookup.c
@@ -133,6 +133,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