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-04-27 20:27:29 +0300
committerCarlos Martín Nieto <cmn@dwim.me>2015-06-22 18:02:54 +0300
commitdfda2f68ea9602a6b0d08e36bd48e6a4899b12ff (patch)
tree55154c8535a53866661e94e5ec9a335d09698d38 /tests/submodule
parent0c94deb90f1ce0e8caf171c85522c66ceb37a4ab (diff)
submodule: remove the per-repo cache
Having this cache and giving them out goes against our multithreading guarantees and it makes it impossible to use submodules in a multi-threaded environment, as any thread can ask for a refresh which may reallocate some string in the submodule struct which we've accessed in a different one via a getter. This makes the submodules behave more like remotes, where each object is created upon request and not shared except explicitly by the user. This means that some tests won't pass yet, as they assume they can affect the submodule objects in the cache and that will affect later operations.
Diffstat (limited to 'tests/submodule')
-rw-r--r--tests/submodule/modify.c2
-rw-r--r--tests/submodule/nosubs.c44
2 files changed, 0 insertions, 46 deletions
diff --git a/tests/submodule/modify.c b/tests/submodule/modify.c
index bbbb2d56e..8f24d9bb5 100644
--- a/tests/submodule/modify.c
+++ b/tests/submodule/modify.c
@@ -50,8 +50,6 @@ void test_submodule_modify__init(void)
/* call init and see that settings are copied */
cl_git_pass(git_submodule_foreach(g_repo, init_one_submodule, NULL));
- git_submodule_reload_all(g_repo, 1);
-
/* confirm submodule data in config */
cl_git_pass(git_repository_config_snapshot(&cfg, g_repo));
cl_git_pass(git_config_get_string(&str, cfg, "submodule.sm_unchanged.url"));
diff --git a/tests/submodule/nosubs.c b/tests/submodule/nosubs.c
index e343c1620..538825c1c 100644
--- a/tests/submodule/nosubs.c
+++ b/tests/submodule/nosubs.c
@@ -21,19 +21,11 @@ void test_submodule_nosubs__lookup(void)
cl_assert_equal_i(GIT_EEXISTS, git_submodule_lookup(&sm, repo, "subrepo"));
- cl_git_pass(git_submodule_reload_all(repo, 0));
-
cl_assert_equal_i(GIT_ENOTFOUND, git_submodule_lookup(&sm, repo, "subdir"));
cl_assert_equal_i(GIT_EEXISTS, git_submodule_lookup(&sm, repo, "subrepo"));
}
-void test_submodule_nosubs__immediate_reload(void)
-{
- git_repository *repo = cl_git_sandbox_init("status");
- cl_git_pass(git_submodule_reload_all(repo, 0));
-}
-
static int fake_submod_cb(git_submodule *sm, const char *n, void *p)
{
GIT_UNUSED(sm); GIT_UNUSED(n); GIT_UNUSED(p);
@@ -57,41 +49,7 @@ void test_submodule_nosubs__add(void)
git_submodule_free(sm2);
cl_git_pass(git_submodule_foreach(repo, fake_submod_cb, NULL));
- cl_git_pass(git_submodule_reload_all(repo, 0));
-
- git_submodule_free(sm);
-}
-
-void test_submodule_nosubs__reload_add_reload(void)
-{
- git_repository *repo = cl_git_sandbox_init("status");
- git_submodule *sm;
-
- cl_git_pass(git_submodule_reload_all(repo, 0));
-
- /* try one add with a reload (to make sure no errors happen) */
-
- cl_git_pass(git_submodule_add_setup(&sm, repo,
- "https://github.com/libgit2/libgit2.git", "submodules/libgit2", 1));
-
- cl_git_pass(git_submodule_reload_all(repo, 0));
-
- cl_assert_equal_s("submodules/libgit2", git_submodule_name(sm));
- git_submodule_free(sm);
-
- cl_git_pass(git_submodule_lookup(&sm, repo, "submodules/libgit2"));
- cl_assert_equal_s("submodules/libgit2", git_submodule_name(sm));
- git_submodule_free(sm);
-
- /* try one add without a reload (to make sure cache inval works, too) */
-
- cl_git_pass(git_submodule_add_setup(&sm, repo,
- "https://github.com/libgit2/libgit2.git", "libgit2-again", 1));
- cl_assert_equal_s("libgit2-again", git_submodule_name(sm));
- git_submodule_free(sm);
- cl_git_pass(git_submodule_lookup(&sm, repo, "libgit2-again"));
- cl_assert_equal_s("libgit2-again", git_submodule_name(sm));
git_submodule_free(sm);
}
@@ -100,10 +58,8 @@ void test_submodule_nosubs__bad_gitmodules(void)
git_repository *repo = cl_git_sandbox_init("status");
cl_git_mkfile("status/.gitmodules", "[submodule \"foobar\"]\tpath=blargle\n\turl=\n\tbranch=\n\tupdate=flooble\n\n");
- cl_git_fail(git_submodule_reload_all(repo, 0));
cl_git_rewritefile("status/.gitmodules", "[submodule \"foobar\"]\tpath=blargle\n\turl=\n\tbranch=\n\tupdate=rebase\n\n");
- cl_git_pass(git_submodule_reload_all(repo, 0));
cl_git_pass(git_submodule_lookup(NULL, repo, "foobar"));
cl_assert_equal_i(GIT_ENOTFOUND, git_submodule_lookup(NULL, repo, "subdir"));