MCPcopy Create free account
hub / github.com/git/git / can_all_from_reach

Function can_all_from_reach

commit-reach.c:958–1014  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

956}
957
958int can_all_from_reach(struct commit_list *from, struct commit_list *to,
959 int cutoff_by_min_date)
960{
961 struct object_array from_objs = OBJECT_ARRAY_INIT;
962 struct commit_list *from_iter = from, *to_iter = to;
963 int result;
964 timestamp_t min_commit_date = cutoff_by_min_date ? from->item->date : 0;
965 timestamp_t min_generation = GENERATION_NUMBER_INFINITY;
966
967 while (from_iter) {
968 add_object_array(&from_iter->item->object, NULL, &from_objs);
969
970 if (!repo_parse_commit(the_repository, from_iter->item)) {
971 timestamp_t generation;
972 if (from_iter->item->date < min_commit_date)
973 min_commit_date = from_iter->item->date;
974
975 generation = commit_graph_generation(from_iter->item);
976 if (generation < min_generation)
977 min_generation = generation;
978 }
979
980 from_iter = from_iter->next;
981 }
982
983 while (to_iter) {
984 if (!repo_parse_commit(the_repository, to_iter->item)) {
985 timestamp_t generation;
986 if (to_iter->item->date < min_commit_date)
987 min_commit_date = to_iter->item->date;
988
989 generation = commit_graph_generation(to_iter->item);
990 if (generation < min_generation)
991 min_generation = generation;
992 }
993
994 to_iter->item->object.flags |= PARENT2;
995
996 to_iter = to_iter->next;
997 }
998
999 result = can_all_from_reach_with_flag(&from_objs, PARENT2, PARENT1,
1000 min_commit_date, min_generation);
1001
1002 while (from) {
1003 clear_commit_marks(from->item, PARENT1);
1004 from = from->next;
1005 }
1006
1007 while (to) {
1008 clear_commit_marks(to->item, PARENT2);
1009 to = to->next;
1010 }
1011
1012 object_array_clear(&from_objs);
1013 return result;
1014}
1015

Callers 2

repo_is_descendant_ofFunction · 0.85
cmd__reachFunction · 0.85

Calls 6

add_object_arrayFunction · 0.85
repo_parse_commitFunction · 0.85
commit_graph_generationFunction · 0.85
clear_commit_marksFunction · 0.85
object_array_clearFunction · 0.85

Tested by 1

cmd__reachFunction · 0.68