1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-06-11 04:36:18 +02:00

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>
This commit is contained in:
Jan Alexander Steffens (heftig) 2023-10-03 20:50:43 +02:00 committed by Junio C Hamano
parent 6327085aa0
commit 387c122131

View File

@ -2889,7 +2889,7 @@ static int absorb_git_dirs(int argc, const char **argv, const char *prefix)
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)