diff --git a/merge-ort.c b/merge-ort.c index 033c4348e2d2b6..5d36c04f509865 100644 --- a/merge-ort.c +++ b/merge-ort.c @@ -1819,6 +1819,7 @@ static int merge_submodule(struct merge_options *opt, _("Failed to merge submodule %s " "(repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2 > 0) @@ -1829,6 +1830,7 @@ static int merge_submodule(struct merge_options *opt, _("Failed to merge submodule %s " "(repository corrupt)"), path); + ret = -1; goto cleanup; } if (!ret2) { @@ -1848,6 +1850,7 @@ static int merge_submodule(struct merge_options *opt, _("Failed to merge submodule %s " "(repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2 > 0) { @@ -1866,6 +1869,7 @@ static int merge_submodule(struct merge_options *opt, _("Failed to merge submodule %s " "(repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2 > 0) { @@ -1899,6 +1903,7 @@ static int merge_submodule(struct merge_options *opt, _("Failed to merge submodule %s " "(repository corrupt)"), path); + ret = -1; break; case 0: path_msg(opt, CONFLICT_SUBMODULE_FAILED_TO_MERGE, 0, diff --git a/merge-recursive.c b/merge-recursive.c index f3132a9ecaeb31..fc772c2b113c94 100644 --- a/merge-recursive.c +++ b/merge-recursive.c @@ -1246,12 +1246,14 @@ static int merge_submodule(struct merge_options *opt, ret2 = repo_in_merge_bases(&subrepo, commit_base, commit_a); if (ret2 < 0) { output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2 > 0) ret2 = repo_in_merge_bases(&subrepo, commit_base, commit_b); if (ret2 < 0) { output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path); + ret = -1; goto cleanup; } if (!ret2) { @@ -1263,6 +1265,7 @@ static int merge_submodule(struct merge_options *opt, ret2 = repo_in_merge_bases(&subrepo, commit_a, commit_b); if (ret2 < 0) { output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2) { @@ -1281,6 +1284,7 @@ static int merge_submodule(struct merge_options *opt, ret2 = repo_in_merge_bases(&subrepo, commit_b, commit_a); if (ret2 < 0) { output(opt, 1, _("Failed to merge submodule %s (repository corrupt)"), path); + ret = -1; goto cleanup; } if (ret2) { @@ -1312,6 +1316,10 @@ static int merge_submodule(struct merge_options *opt, parent_count = find_first_merges(&subrepo, &merges, path, commit_a, commit_b); switch (parent_count) { + case -1: + output(opt, 1,_("Failed to merge submodule %s (repository corrupt)"), path); + ret = -1; + break; case 0: output(opt, 1, _("Failed to merge submodule %s (merge following commits not found)"), path); break;