summaryrefslogtreecommitdiff
path: root/tests/diff/submodules.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2014-03-25 09:14:48 -0700
committerRussell Belfer <rb@github.com>2014-03-25 09:14:48 -0700
commita15c7802c86cf995fa658ef0624c46d352ce9a81 (patch)
tree25bebc086059abc13e74a3a8b4e461c0cf06dc64 /tests/diff/submodules.c
parentf210cb5b1442f82e2f930909d8430f7cc6661c5f (diff)
downloadlibgit2-a15c7802c86cf995fa658ef0624c46d352ce9a81.tar.gz
Make submodules externally refcounted
`git_submodule` objects were already refcounted internally in case the submodule name was different from the path at which it was stored. This makes that refcounting externally used as well, so `git_submodule_lookup` and `git_submodule_add_setup` return an object that requires a `git_submodule_free` when done.
Diffstat (limited to 'tests/diff/submodules.c')
-rw-r--r--tests/diff/submodules.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/diff/submodules.c b/tests/diff/submodules.c
index da96ba9c5..62e07e0c6 100644
--- a/tests/diff/submodules.c
+++ b/tests/diff/submodules.c
@@ -123,7 +123,7 @@ void test_diff_submodules__dirty_submodule_2(void)
g_repo = setup_fixture_submodules();
- cl_git_pass(git_submodule_reload_all(g_repo));
+ cl_git_pass(git_submodule_reload_all(g_repo, 1));
opts.flags = GIT_DIFF_INCLUDE_UNTRACKED |
GIT_DIFF_SHOW_UNTRACKED_CONTENT |
@@ -157,7 +157,7 @@ void test_diff_submodules__dirty_submodule_2(void)
git_diff_free(diff);
- cl_git_pass(git_submodule_reload_all(g_repo));
+ cl_git_pass(git_submodule_reload_all(g_repo, 1));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_dirty);
@@ -281,7 +281,9 @@ void test_diff_submodules__invalid_cache(void)
check_diff_patches(diff, expected_dirty);
git_diff_free(diff);
- cl_git_pass(git_submodule_reload_all(g_repo));
+ git_submodule_free(sm);
+
+ cl_git_pass(git_submodule_reload_all(g_repo, 1));
cl_git_pass(git_submodule_lookup(&sm, g_repo, smpath));
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
@@ -334,6 +336,8 @@ void test_diff_submodules__invalid_cache(void)
p_unlink("submod2/sm_changed_head/new_around_here");
+ git_submodule_free(sm);
+
cl_git_pass(git_diff_index_to_workdir(&diff, g_repo, NULL, &opts));
check_diff_patches(diff, expected_moved);
git_diff_free(diff);