Merge branch 'js/merge-base-with-missing-commit'

Make sure failure return from merge_bases_many() is properly caught.

* js/merge-base-with-missing-commit:
  merge-ort/merge-recursive: do report errors in `merge_submodule()`
  merge-recursive: prepare for `merge_submodule()` to report errors
  commit-reach(repo_get_merge_bases_many_dirty): pass on errors
  commit-reach(repo_get_merge_bases_many): pass on "missing commits" errors
  commit-reach(get_octopus_merge_bases): pass on "missing commits" errors
  commit-reach(repo_get_merge_bases): pass on "missing commits" errors
  commit-reach(get_merge_bases_many_0): pass on "missing commits" errors
  commit-reach(merge_bases_many): pass on "missing commits" errors
  commit-reach(paint_down_to_common): start reporting errors
  commit-reach(paint_down_to_common): prepare for handling shallow commits
  commit-reach(repo_in_merge_bases_many): report missing commits
  commit-reach(repo_in_merge_bases_many): optionally expect missing commits
  commit-reach(paint_down_to_common): plug two memory leaks
This commit is contained in:
Junio C Hamano
2024-03-11 14:12:30 -07:00
29 changed files with 460 additions and 188 deletions

View File

@ -3912,7 +3912,7 @@ static int do_merge(struct repository *r,
int run_commit_flags = 0;
struct strbuf ref_name = STRBUF_INIT;
struct commit *head_commit, *merge_commit, *i;
struct commit_list *bases, *j;
struct commit_list *bases = NULL, *j;
struct commit_list *to_merge = NULL, **tail = &to_merge;
const char *strategy = !opts->xopts.nr &&
(!opts->strategy ||
@ -4138,7 +4138,11 @@ static int do_merge(struct repository *r,
}
merge_commit = to_merge->item;
bases = repo_get_merge_bases(r, head_commit, merge_commit);
if (repo_get_merge_bases(r, head_commit, merge_commit, &bases) < 0) {
ret = -1;
goto leave_merge;
}
if (bases && oideq(&merge_commit->object.oid,
&bases->item->object.oid)) {
ret = 0;