summaryrefslogtreecommitdiff
path: root/src/libgit2/submodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libgit2/submodule.c')
-rw-r--r--src/libgit2/submodule.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libgit2/submodule.c b/src/libgit2/submodule.c
index 0f4f0726c..95ea84fc2 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...)
@@ -1389,7 +1393,7 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
*/
clone_options.checkout_opts.checkout_strategy = GIT_CHECKOUT_NONE;
- if ((error = git_clone(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
+ if ((error = git_clone__submodule(&sub_repo, submodule_url, sm->path, &clone_options)) < 0 ||
(error = git_repository_set_head_detached(sub_repo, git_submodule_index_id(sm))) < 0 ||
(error = git_checkout_head(sub_repo, &update_options.checkout_opts)) != 0)
goto done;