Skip to content

Commit b57b762

Browse files
authored
tests: Add new test to submodule::update
Verify that trying to update submodule which has been configured but not added does return an error. Issue libgit2#6433: git_submodule_update fails to update configured but missing submodule
1 parent 12832ba commit b57b762

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/libgit2/submodule/update.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,26 @@ void test_submodule_update__update_and_init_submodule(void)
206206
git_submodule_free(sm);
207207
}
208208

209+
void test_submodule_update__update_skip_configured_missing_submodule(void)
210+
{
211+
git_submodule *sm;
212+
git_submodule_update_options update_options = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
213+
unsigned int submodule_status = 0;
214+
215+
g_repo = setup_fixture_submod2();
216+
217+
/* get the submodule */
218+
cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_gitmodules_only"));
219+
220+
cl_git_pass(git_submodule_status(&submodule_status, g_repo, "sm_gitmodules_only", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
221+
cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_CONFIG);
222+
223+
/* update (with option to initialize sub repo) */
224+
cl_git_pass(git_submodule_update(sm, 1, &update_options));
225+
226+
git_submodule_free(sm);
227+
}
228+
209229
void test_submodule_update__update_already_checked_out_submodule(void)
210230
{
211231
git_submodule *sm = NULL;

0 commit comments

Comments
 (0)