aboutsummaryrefslogtreecommitdiffstats
path: root/object-name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2024-03-11 14:12:30 -0700
committerJunio C Hamano <gitster@pobox.com>2024-03-11 14:12:30 -0700
commit7745f92507517c4e60dc2a7faad40eee49ee670b (patch)
treef9eb30d1767f40a69db6b874f50bbdc8953d745d /object-name.c
parente09f1254c54329773904fe25d7c545a1fb4fa920 (diff)
parent25fd20eb44cfcbb0652595de2144f0e077a957ec (diff)
downloadgit-7745f92507517c4e60dc2a7faad40eee49ee670b.tar.gz
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 'object-name.c')
-rw-r--r--object-name.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/object-name.c b/object-name.c
index 511f09bc0f..bd77695d7e 100644
--- a/object-name.c
+++ b/object-name.c
@@ -1488,7 +1488,7 @@ int repo_get_oid_mb(struct repository *r,
struct object_id *oid)
{
struct commit *one, *two;
- struct commit_list *mbs;
+ struct commit_list *mbs = NULL;
struct object_id oid_tmp;
const char *dots;
int st;
@@ -1516,7 +1516,10 @@ int repo_get_oid_mb(struct repository *r,
two = lookup_commit_reference_gently(r, &oid_tmp, 0);
if (!two)
return -1;
- mbs = repo_get_merge_bases(r, one, two);
+ if (repo_get_merge_bases(r, one, two, &mbs) < 0) {
+ free_commit_list(mbs);
+ return -1;
+ }
if (!mbs || mbs->next)
st = -1;
else {