summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortagesuhu <118989859+tagesuhu@users.noreply.github.com>2022-11-25 16:38:58 +0000
committerGitHub <noreply@github.com>2022-11-25 16:38:58 +0000
commit3f4b91b29d5d4d30d2796da336742ed371646208 (patch)
tree6d47f593948aa42279c67e5e4bf66415d63aace6
parentb57b7628d4a7c66727252a9e2d219e566b04a867 (diff)
downloadlibgit2-3f4b91b29d5d4d30d2796da336742ed371646208.tar.gz
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
-rw-r--r--src/libgit2/submodule.c6
1 files changed, 5 insertions, 1 deletions
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...)