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>
This commit is contained in:
committed by
Junio C Hamano
parent
207c40e1e4
commit
24876ebf68
@ -158,6 +158,8 @@ static int branch_merged(int kind, const char *name,
|
||||
|
||||
merged = reference_rev ? repo_in_merge_bases(the_repository, rev,
|
||||
reference_rev) : 0;
|
||||
if (merged < 0)
|
||||
exit(128);
|
||||
|
||||
/*
|
||||
* After the safety valve is fully redefined to "check with
|
||||
@ -166,9 +168,13 @@ static int branch_merged(int kind, const char *name,
|
||||
* any of the following code, but during the transition period,
|
||||
* a gentle reminder is in order.
|
||||
*/
|
||||
if ((head_rev != reference_rev) &&
|
||||
(head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0) != merged) {
|
||||
if (merged)
|
||||
if (head_rev != reference_rev) {
|
||||
int expect = head_rev ? repo_in_merge_bases(the_repository, rev, head_rev) : 0;
|
||||
if (expect < 0)
|
||||
exit(128);
|
||||
if (expect == merged)
|
||||
; /* okay */
|
||||
else if (merged)
|
||||
warning(_("deleting branch '%s' that has been merged to\n"
|
||||
" '%s', but not yet merged to HEAD"),
|
||||
name, reference_name);
|
||||
|
||||
Reference in New Issue
Block a user