diff options
| -rw-r--r-- | builtin/submodule--helper.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index cc32eb0dc3..f8470d848e 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2484,13 +2484,6 @@ static int update_submodule(struct update_data *update_data) { int ret; - ret = ensure_core_worktree(update_data->sm_path); - if (ret) - return ret; - - update_data->displaypath = get_submodule_displaypath( - update_data->sm_path, update_data->prefix); - ret = determine_submodule_update_strategy(the_repository, update_data->just_cloned, update_data->sm_path, @@ -2596,7 +2589,15 @@ static int update_submodules(struct update_data *update_data) update_data->just_cloned = ucd.just_cloned; update_data->sm_path = ucd.sub->path; + code = ensure_core_worktree(update_data->sm_path); + if (code) + goto fail; + + update_data->displaypath = get_submodule_displaypath( + update_data->sm_path, update_data->prefix); code = update_submodule(update_data); + FREE_AND_NULL(update_data->displaypath); +fail: if (!code) continue; ret = code; |
