diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2024-02-28 10:44:14 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-02-29 17:06:01 +0100 |
commit | 76e2a0999907644966dfe48b573d6e57e2f1e275 (patch) | |
tree | a39782ae673aff3eade9b30efb619e4fdbbea9c2 /commit-reach.c | |
parent | commit-reach(get_merge_bases_many_0): pass on "missing commits" errors (diff) | |
download | git-76e2a0999907644966dfe48b573d6e57e2f1e275.tar.xz git-76e2a0999907644966dfe48b573d6e57e2f1e275.zip |
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 'commit-reach.c')
-rw-r--r-- | commit-reach.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/commit-reach.c b/commit-reach.c index 95cbfae0eb..ff2c5ce89f 100644 --- a/commit-reach.c +++ b/commit-reach.c @@ -188,9 +188,12 @@ struct commit_list *get_octopus_merge_bases(struct commit_list *in) struct commit_list *new_commits = NULL, *end = NULL; for (j = ret; j; j = j->next) { - struct commit_list *bases; - bases = repo_get_merge_bases(the_repository, i->item, - j->item); + struct commit_list *bases = NULL; + if (repo_get_merge_bases(the_repository, i->item, + j->item, &bases) < 0) { + free_commit_list(bases); + return NULL; + } if (!new_commits) new_commits = bases; else @@ -482,16 +485,12 @@ struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r, return result; } -struct commit_list *repo_get_merge_bases(struct repository *r, - struct commit *one, - struct commit *two) +int repo_get_merge_bases(struct repository *r, + struct commit *one, + struct commit *two, + struct commit_list **result) { - struct commit_list *result = NULL; - if (get_merge_bases_many_0(r, one, 1, &two, 1, &result) < 0) { - free_commit_list(result); - return NULL; - } - return result; + return get_merge_bases_many_0(r, one, 1, &two, 1, result); } /* |