Skip to content

Commit 3f4b91b

Browse files
authored
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 libgit2#6433: git_submodule_update fails to update configured but missing submodule
1 parent b57b762 commit 3f4b91b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/libgit2/submodule.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,11 @@ int git_submodule_update(git_submodule *sm, int init, git_submodule_update_optio
13381338
/* Get the status of the submodule to determine if it is already initialized */
13391339
if ((error = git_submodule_status(&submodule_status, sm->repo, sm->name, GIT_SUBMODULE_IGNORE_UNSPECIFIED)) < 0)
13401340
goto done;
1341-
1341+
1342+
/* If the submodule is configured but hasn't been added, skip it */
1343+
if (submodule_status == GIT_SUBMODULE_STATUS_IN_CONFIG)
1344+
goto done;
1345+
13421346
/*
13431347
* If submodule work dir is not already initialized, check to see
13441348
* what we need to do (initialize, clone, return error...)

0 commit comments

Comments
 (0)