summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortagesuhu <118989859+tagesuhu@users.noreply.github.com>2022-11-25 16:32:39 +0000
committerGitHub <noreply@github.com>2022-11-25 16:32:39 +0000
commitb57b7628d4a7c66727252a9e2d219e566b04a867 (patch)
tree978ade9abbab6709a625054ab9f482a34281764b
parent12832bab7363e92bfa45d1ef3c3bc10495d71abd (diff)
downloadlibgit2-b57b7628d4a7c66727252a9e2d219e566b04a867.tar.gz
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 #6433: git_submodule_update fails to update configured but missing submodule
-rw-r--r--tests/libgit2/submodule/update.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/libgit2/submodule/update.c b/tests/libgit2/submodule/update.c
index 4aa959852..052a4a1fe 100644
--- a/tests/libgit2/submodule/update.c
+++ b/tests/libgit2/submodule/update.c
@@ -206,6 +206,26 @@ void test_submodule_update__update_and_init_submodule(void)
git_submodule_free(sm);
}
+void test_submodule_update__update_skip_configured_missing_submodule(void)
+{
+ git_submodule *sm;
+ git_submodule_update_options update_options = GIT_SUBMODULE_UPDATE_OPTIONS_INIT;
+ unsigned int submodule_status = 0;
+
+ g_repo = setup_fixture_submod2();
+
+ /* get the submodule */
+ cl_git_pass(git_submodule_lookup(&sm, g_repo, "sm_gitmodules_only"));
+
+ cl_git_pass(git_submodule_status(&submodule_status, g_repo, "sm_gitmodules_only", GIT_SUBMODULE_IGNORE_UNSPECIFIED));
+ cl_assert_equal_i(submodule_status, GIT_SUBMODULE_STATUS_IN_CONFIG);
+
+ /* update (with option to initialize sub repo) */
+ cl_git_pass(git_submodule_update(sm, 1, &update_options));
+
+ git_submodule_free(sm);
+}
+
void test_submodule_update__update_already_checked_out_submodule(void)
{
git_submodule *sm = NULL;