diff options
| author | Jan Alexander Steffens (heftig) <heftig@archlinux.org> | 2023-10-03 20:50:43 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2023-10-03 15:30:43 -0700 |
| commit | 387c122131a9f8e4a67122d53955133d099b64a7 (patch) | |
| tree | 9dc8a3ab420ca5256b5e8e29e5e80f5239bbff58 | |
| parent | 6327085aa027b7d5936912bed596a3cf86953439 (diff) | |
| download | git-387c122131a9f8e4a67122d53955133d099b64a7.tar.gz | |
submodule--helper: return error from set-url when modifying failed
set-branch will return an error when setting the config fails so I don't
see why set-url shouldn't. Also skip the sync in this case.
Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
| -rw-r--r-- | builtin/submodule--helper.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c index 0c1509ad6e..cce46450ab 100644 --- a/builtin/submodule--helper.c +++ b/builtin/submodule--helper.c @@ -2889,7 +2889,7 @@ cleanup: static int module_set_url(int argc, const char **argv, const char *prefix) { - int quiet = 0; + int quiet = 0, ret; const char *newurl; const char *path; char *config_name; @@ -2915,13 +2915,15 @@ static int module_set_url(int argc, const char **argv, const char *prefix) path); config_name = xstrfmt("submodule.%s.url", sub->name); - config_set_in_gitmodules_file_gently(config_name, newurl); + ret = config_set_in_gitmodules_file_gently(config_name, newurl); - repo_read_gitmodules (the_repository, 0); - sync_submodule(sub->path, prefix, NULL, quiet ? OPT_QUIET : 0); + if (!ret) { + repo_read_gitmodules(the_repository, 0); + sync_submodule(sub->path, prefix, NULL, quiet ? OPT_QUIET : 0); + } free(config_name); - return 0; + return !!ret; } static int module_set_branch(int argc, const char **argv, const char *prefix) |
