aboutsummaryrefslogtreecommitdiffstats
path: root/object-name.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2024-02-28 09:44:14 +0000
committerJunio C Hamano <gitster@pobox.com>2024-02-29 08:06:01 -0800
commit76e2a0999907644966dfe48b573d6e57e2f1e275 (patch)
treea39782ae673aff3eade9b30efb619e4fdbbea9c2 /object-name.c
parent8226e157a92066855811188f7ca3fd4bff5f083d (diff)
downloadgit-76e2a0999907644966dfe48b573d6e57e2f1e275.tar.gz
commit-reach(repo_get_merge_bases): pass on "missing commits" errors
The `merge_bases_many()` function was just taught to indicate parsing errors, and now the `repo_get_merge_bases()` function (which is also surfaced via the `repo_get_merge_bases()` macro) is aware of that, too. Naturally, there are a lot of callers that need to be adjusted now, too. Next step: adjust the callers of `get_octopus_merge_bases()`. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
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 3a2ef5d680..638608523d 100644
--- a/object-name.c
+++ b/object-name.c
@@ -1479,7 +1479,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;
@@ -1507,7 +1507,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 {