diff options
author | tagesuhu <118989859+tagesuhu@users.noreply.github.com> | 2022-11-25 16:32:39 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-25 16:32:39 +0000 |
commit | b57b7628d4a7c66727252a9e2d219e566b04a867 (patch) | |
tree | 978ade9abbab6709a625054ab9f482a34281764b /tests/libgit2 | |
parent | 12832bab7363e92bfa45d1ef3c3bc10495d71abd (diff) | |
download | libgit2-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
Diffstat (limited to 'tests/libgit2')
-rw-r--r-- | tests/libgit2/submodule/update.c | 20 |
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; |