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
path: root/tests
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-07-01 22:10:40 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-07-01 22:14:55 +0300
commite8e848a8dad92b6542b16449d29f4a5535fa7c5a (patch)
tree20047928147df8169f29b8eb2e73e2b15611d349 /tests
parentbf7d2761d4d9da79c3ae26e94da6a95b27e8769f (diff)
submodule: add failing test for loading the wrong submodule
When two submodules are fairly similar, we may end up loading the wrong one.
Diffstat (limited to 'tests')
-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 cddbdcfc2..4d40e2279 100644
--- a/tests/submodule/lookup.c
+++ b/tests/submodule/lookup.c
@@ -269,3 +269,26 @@ void test_submodule_lookup__just_added(void)
refute_submodule_exists(g_repo, "sm_just_added_head", GIT_EEXISTS);
}
+/* Test_App and Test_App2 are fairly similar names, make sure we load the right one */
+void test_submodule_lookup__prefix_name(void)
+{
+ git_submodule *sm;
+
+ cl_git_rewritefile("submod2/.gitmodules",
+ "[submodule \"Test_App\"]\n"
+ " path = Test_App\n"
+ " url = ../Test_App\n"
+ "[submodule \"Test_App2\"]\n"
+ " path = Test_App2\n"
+ " url = ../Test_App\n");
+
+ cl_git_pass(git_submodule_lookup(&sm, g_repo, "Test_App"));
+ cl_assert_equal_s("Test_App", git_submodule_name(sm));
+
+ git_submodule_free(sm);
+
+ cl_git_pass(git_submodule_lookup(&sm, g_repo, "Test_App2"));
+ cl_assert_equal_s("Test_App2", git_submodule_name(sm));
+
+ git_submodule_free(sm);
+}