diff options
author | Junio C Hamano <gitster@pobox.com> | 2024-03-11 21:12:30 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-03-11 21:12:30 (GMT) |
commit | 7745f92507517c4e60dc2a7faad40eee49ee670b (patch) | |
tree | f9eb30d1767f40a69db6b874f50bbdc8953d745d /revision.c | |
parent | e09f1254c54329773904fe25d7c545a1fb4fa920 (diff) | |
parent | 25fd20eb44cfcbb0652595de2144f0e077a957ec (diff) | |
download | git-7745f92507517c4e60dc2a7faad40eee49ee670b.zip git-7745f92507517c4e60dc2a7faad40eee49ee670b.tar.gz git-7745f92507517c4e60dc2a7faad40eee49ee670b.tar.bz2 |
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
Diffstat (limited to 'revision.c')
-rw-r--r-- | revision.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1992,7 +1992,7 @@ static const char *lookup_other_head(struct object_id *oid) static void prepare_show_merge(struct rev_info *revs) { - struct commit_list *bases; + struct commit_list *bases = NULL; struct commit *head, *other; struct object_id oid; const char *other_name; @@ -2007,7 +2007,8 @@ static void prepare_show_merge(struct rev_info *revs) other = lookup_commit_or_die(&oid, other_name); add_pending_object(revs, &head->object, "HEAD"); add_pending_object(revs, &other->object, other_name); - bases = repo_get_merge_bases(the_repository, head, other); + if (repo_get_merge_bases(the_repository, head, other, &bases) < 0) + exit(128); add_rev_cmdline_list(revs, bases, REV_CMD_MERGE_BASE, UNINTERESTING | BOTTOM); add_pending_commit_list(revs, bases, UNINTERESTING | BOTTOM); free_commit_list(bases); @@ -2095,14 +2096,17 @@ static int handle_dotdot_1(const char *arg, char *dotdot, } else { /* A...B -- find merge bases between the two */ struct commit *a, *b; - struct commit_list *exclude; + struct commit_list *exclude = NULL; a = lookup_commit_reference(revs->repo, &a_obj->oid); b = lookup_commit_reference(revs->repo, &b_obj->oid); if (!a || !b) return dotdot_missing(arg, dotdot, revs, symmetric); - exclude = repo_get_merge_bases(the_repository, a, b); + if (repo_get_merge_bases(the_repository, a, b, &exclude) < 0) { + free_commit_list(exclude); + return -1; + } add_rev_cmdline_list(revs, exclude, REV_CMD_MERGE_BASE, flags_exclude); add_pending_commit_list(revs, exclude, flags_exclude); |