* Test whether the candidate is contained in the list. * Do not recurse to find out, though, but return -1 if inconclusive. */
| 760 | * Do not recurse to find out, though, but return -1 if inconclusive. |
| 761 | */ |
| 762 | static enum contains_result contains_test(struct commit *candidate, |
| 763 | const struct commit_list *want, |
| 764 | struct contains_cache *cache, |
| 765 | timestamp_t cutoff) |
| 766 | { |
| 767 | enum contains_result *cached = contains_cache_at(cache, candidate); |
| 768 | |
| 769 | /* If we already have the answer cached, return that. */ |
| 770 | if (*cached) |
| 771 | return *cached; |
| 772 | |
| 773 | /* or are we it? */ |
| 774 | if (in_commit_list(want, candidate)) { |
| 775 | *cached = CONTAINS_YES; |
| 776 | return CONTAINS_YES; |
| 777 | } |
| 778 | |
| 779 | /* Otherwise, we don't know; prepare to recurse */ |
| 780 | parse_commit_or_die(candidate); |
| 781 | |
| 782 | if (commit_graph_generation(candidate) < cutoff) |
| 783 | return CONTAINS_NO; |
| 784 | |
| 785 | return CONTAINS_UNKNOWN; |
| 786 | } |
| 787 | |
| 788 | static void push_to_contains_stack(struct commit *candidate, struct contains_stack *contains_stack) |
| 789 | { |
no test coverage detected