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
@ -926,6 +926,8 @@ static int get_can_ff(struct object_id *orig_head,
|
||||
merge_head = lookup_commit_reference(the_repository, orig_merge_head);
|
||||
ret = repo_is_descendant_of(the_repository, merge_head, list);
|
||||
free_commit_list(list);
|
||||
if (ret < 0)
|
||||
exit(128);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -950,6 +952,8 @@ static int already_up_to_date(struct object_id *orig_head,
|
||||
commit_list_insert(theirs, &list);
|
||||
ok = repo_is_descendant_of(the_repository, ours, list);
|
||||
free_commit_list(list);
|
||||
if (ok < 0)
|
||||
exit(128);
|
||||
if (!ok)
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user