Skip to content

Commit

Permalink
repo_get_merge_bases_many_dirty(): pass on errors from `merge_bases_m…
Browse files Browse the repository at this point in the history
…any()`

The `merge_bases_many()` function was just taught to indicate parsing
errors, and now the `repo_get_merge_bases_many_dirty()` function is
aware of that, too.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
  • Loading branch information
dscho committed Feb 22, 2024
1 parent 602a738 commit 96850ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
9 changes: 6 additions & 3 deletions builtin/merge-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@

static int show_merge_base(struct commit **rev, int rev_nr, int show_all)
{
struct commit_list *result, *r;
struct commit_list *result = NULL, *r;

result = repo_get_merge_bases_many_dirty(the_repository, rev[0],
rev_nr - 1, rev + 1);
if (repo_get_merge_bases_many_dirty(the_repository, rev[0],
rev_nr - 1, rev + 1, &result) < 0) {
free_commit_list(result);
return -1;
}

if (!result)
return 1;
Expand Down
16 changes: 6 additions & 10 deletions commit-reach.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,17 +471,13 @@ int repo_get_merge_bases_many(struct repository *r,
return get_merge_bases_many_0(r, one, n, twos, 1, result);
}

struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one,
int n,
struct commit **twos)
int repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one,
int n,
struct commit **twos,
struct commit_list **result)
{
struct commit_list *result = NULL;
if (get_merge_bases_many_0(r, one, n, twos, 0, &result) < 0) {
free_commit_list(result);
return NULL;
}
return result;
return get_merge_bases_many_0(r, one, n, twos, 0, result);
}

int repo_get_merge_bases(struct repository *r,
Expand Down
7 changes: 4 additions & 3 deletions commit-reach.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ int repo_get_merge_bases_many(struct repository *r,
struct commit **twos,
struct commit_list **result);
/* To be used only when object flags after this call no longer matter */
struct commit_list *repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one, int n,
struct commit **twos);
int repo_get_merge_bases_many_dirty(struct repository *r,
struct commit *one, int n,
struct commit **twos,
struct commit_list **result);

int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result);

Expand Down

0 comments on commit 96850ed

Please sign in to comment.