diff options
| author | Patrick Steinhardt <ps@pks.im> | 2018-06-06 08:36:43 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-06 08:36:43 +0200 |
| commit | 54990d757c8abd4b63aac5f255b5219d3fb9d98e (patch) | |
| tree | edb5a1320ec49e67913a38acc0c3997dc8c59c9d /tests/submodule | |
| parent | bae6ed62010508c2e2b0559f9eee41e62e52eb7a (diff) | |
| parent | 9c698a256f27bfe98df39322c3e29a02d48f6973 (diff) | |
| download | libgit2-54990d757c8abd4b63aac5f255b5219d3fb9d98e.tar.gz | |
Merge pull request #4641 from pks-t/pks/submodule-names-memleak
Detect duplicated submodules for the same path
Diffstat (limited to 'tests/submodule')
| -rw-r--r-- | tests/submodule/lookup.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/submodule/lookup.c b/tests/submodule/lookup.c index 170be5a44..5db5c2dd6 100644 --- a/tests/submodule/lookup.c +++ b/tests/submodule/lookup.c @@ -132,6 +132,32 @@ void test_submodule_lookup__foreach(void) cl_assert_equal_i(8, data.count); } +static int sm_dummy_cb(git_submodule *sm, const char *name, void *payload) +{ + GIT_UNUSED(sm); + GIT_UNUSED(name); + GIT_UNUSED(payload); + return 0; +} + +void test_submodule_lookup__duplicated_path(void) +{ + /* + * Manually invoke cleanup methods to remove leftovers + * from `setup_fixture_submod2` + */ + cl_git_sandbox_cleanup(); + cl_fixture_cleanup("submod2_target"); + + g_repo = setup_fixture_submodules(); + + /* + * This should fail, as the submodules repo has an + * invalid gitmodules file with duplicated paths. + */ + cl_git_fail(git_submodule_foreach(g_repo, sm_dummy_cb, NULL)); +} + void test_submodule_lookup__lookup_even_with_unborn_head(void) { git_reference *head; |
