From 3f4b91b29d5d4d30d2796da336742ed371646208 Mon Sep 17 00:00:00 2001 From: tagesuhu <118989859+tagesuhu@users.noreply.github.com> Date: Fri, 25 Nov 2022 16:38:58 +0000 Subject: [PATCH] submodule: Do not try to update a missing submodule If a submodule has been configured but not yet added, do not try to update it. Issue #6433: git_submodule_update fails to update configured but missing submodule --- src/libgit2/submodule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libgit2/submodule.c b/src/libgit2/submodule.c index 0f4f0726c..b57ecff5c 100644 --- a/src/libgit2/submodule.c +++ b/src/libgit2/submodule.c @@ -1338,7 +1338,11 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio /* Get the status of the submodule to determine if it is already initialized */ if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0) goto done; - + + /* If the submodule is configured but hasn't been added, skip it */ + if (submodule_status == GIT_SUBMODULE_STATUS_IN_CONFIG) + goto done; + /* * If submodule work dir is not already initialized, check to see * what we need to do (initialize, clone, return error...)