MCPcopy Index your code
hub / github.com/git/git / contains_test

Function contains_test

commit-reach.c:762–786  ·  view source on GitHub ↗

* Test whether the candidate is contained in the list. * Do not recurse to find out, though, but return -1 if inconclusive. */

Source from the content-addressed store, hash-verified

760 * Do not recurse to find out, though, but return -1 if inconclusive.
761 */
762static 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
788static void push_to_contains_stack(struct commit *candidate, struct contains_stack *contains_stack)
789{

Callers 1

contains_tag_algoFunction · 0.85

Calls 3

in_commit_listFunction · 0.85
parse_commit_or_dieFunction · 0.85
commit_graph_generationFunction · 0.85

Tested by

no test coverage detected