mirror of
https://github.com/git/git.git
synced 2026-08-09 01:21:47 +00:00
commit-reach: die on contains walk errors
Without generation numbers, repo_is_descendant_of() can return -1 when it cannot read commit ancestry. commit_contains() exposes that result through a Boolean interface, so ref-filter treats it as true. This can include a ref for --contains or exclude it for --no-contains without failing the command. Die when repo_is_descendant_of() reports an error. The memoized walk already dies when it cannot parse a commit, so callers of the non-memoized path no longer turn a failed walk into a match. Reported-by: Jeff King <peff@peff.net> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
ca96eeee79
commit
ff3ba7d158
@@ -854,10 +854,16 @@ static enum contains_result contains_tag_algo(struct commit *candidate,
|
||||
int commit_contains(struct ref_filter *filter, struct commit *commit,
|
||||
struct commit_list *list, struct contains_cache *cache)
|
||||
{
|
||||
int result;
|
||||
|
||||
if (filter->with_commit_tag_algo ||
|
||||
generation_numbers_enabled(the_repository))
|
||||
return contains_tag_algo(commit, list, cache) == CONTAINS_YES;
|
||||
return repo_is_descendant_of(the_repository, commit, list);
|
||||
|
||||
result = repo_is_descendant_of(the_repository, commit, list);
|
||||
if (result < 0)
|
||||
die(_("failed to check reachability"));
|
||||
return result;
|
||||
}
|
||||
|
||||
int can_all_from_reach_with_flag(struct object_array *from,
|
||||
|
||||
Reference in New Issue
Block a user