commit-reach(repo_in_merge_bases_many): report missing commits
commit24876ebf68baf90075dad5ca3acba8a305f308d4
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Wed, 28 Feb 2024 09:44:09 +0000 (28 09:44 +0000)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Feb 2024 17:47:03 +0000 (28 09:47 -0800)
tree99968921866edefd3c3a357073df5652232f3f85
parent207c40e1e43c992a8b268a3395ca104566612c6e
commit-reach(repo_in_merge_bases_many): report missing commits

Some functions in Git's source code follow the convention that returning
a negative value indicates a fatal error, e.g. repository corruption.

Let's use this convention in `repo_in_merge_bases()` to report when one
of the specified commits is missing (i.e. when `repo_parse_commit()`
reports an error).

Also adjust the callers of `repo_in_merge_bases()` to handle such
negative return values.

Note: As of this patch, errors are returned only if any of the specified
merge heads is missing. Over the course of the next patches, missing
commits will also be reported by the `paint_down_to_common()` function,
which is called by `repo_in_merge_bases_many()`, and those errors will
be properly propagated back to the caller at that stage.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 files changed:
builtin/branch.c
builtin/fast-import.c
builtin/fetch.c
builtin/log.c
builtin/merge-base.c
builtin/pull.c
builtin/receive-pack.c
commit-reach.c
http-push.c
merge-ort.c
merge-recursive.c
shallow.c