3 #include "commit-graph.h"
5 #include "prio-queue.h"
7 #include "ref-filter.h"
10 #include "commit-reach.h"
12 /* Remember to update object flag allocation in object.h */
13 #define PARENT1 (1u<<16)
14 #define PARENT2 (1u<<17)
15 #define STALE (1u<<18)
16 #define RESULT (1u<<19)
18 static const unsigned all_flags
= (PARENT1
| PARENT2
| STALE
| RESULT
);
20 static int compare_commits_by_gen(const void *_a
, const void *_b
)
22 const struct commit
*a
= *(const struct commit
* const *)_a
;
23 const struct commit
*b
= *(const struct commit
* const *)_b
;
25 timestamp_t generation_a
= commit_graph_generation(a
);
26 timestamp_t generation_b
= commit_graph_generation(b
);
28 if (generation_a
< generation_b
)
30 if (generation_a
> generation_b
)
35 static int queue_has_nonstale(struct prio_queue
*queue
)
38 for (i
= 0; i
< queue
->nr
; i
++) {
39 struct commit
*commit
= queue
->array
[i
].data
;
40 if (!(commit
->object
.flags
& STALE
))
46 /* all input commits in one and twos[] must have been parsed! */
47 static struct commit_list
*paint_down_to_common(struct repository
*r
,
48 struct commit
*one
, int n
,
50 timestamp_t min_generation
)
52 struct prio_queue queue
= { compare_commits_by_gen_then_commit_date
};
53 struct commit_list
*result
= NULL
;
55 timestamp_t last_gen
= GENERATION_NUMBER_INFINITY
;
57 if (!min_generation
&& !corrected_commit_dates_enabled(r
))
58 queue
.compare
= compare_commits_by_commit_date
;
60 one
->object
.flags
|= PARENT1
;
62 commit_list_append(one
, &result
);
65 prio_queue_put(&queue
, one
);
67 for (i
= 0; i
< n
; i
++) {
68 twos
[i
]->object
.flags
|= PARENT2
;
69 prio_queue_put(&queue
, twos
[i
]);
72 while (queue_has_nonstale(&queue
)) {
73 struct commit
*commit
= prio_queue_get(&queue
);
74 struct commit_list
*parents
;
76 timestamp_t generation
= commit_graph_generation(commit
);
78 if (min_generation
&& generation
> last_gen
)
79 BUG("bad generation skip %"PRItime
" > %"PRItime
" at %s",
81 oid_to_hex(&commit
->object
.oid
));
82 last_gen
= generation
;
84 if (generation
< min_generation
)
87 flags
= commit
->object
.flags
& (PARENT1
| PARENT2
| STALE
);
88 if (flags
== (PARENT1
| PARENT2
)) {
89 if (!(commit
->object
.flags
& RESULT
)) {
90 commit
->object
.flags
|= RESULT
;
91 commit_list_insert_by_date(commit
, &result
);
93 /* Mark parents of a found merge stale */
96 parents
= commit
->parents
;
98 struct commit
*p
= parents
->item
;
99 parents
= parents
->next
;
100 if ((p
->object
.flags
& flags
) == flags
)
102 if (repo_parse_commit(r
, p
))
104 p
->object
.flags
|= flags
;
105 prio_queue_put(&queue
, p
);
109 clear_prio_queue(&queue
);
113 static struct commit_list
*merge_bases_many(struct repository
*r
,
114 struct commit
*one
, int n
,
115 struct commit
**twos
)
117 struct commit_list
*list
= NULL
;
118 struct commit_list
*result
= NULL
;
121 for (i
= 0; i
< n
; i
++) {
124 * We do not mark this even with RESULT so we do not
125 * have to clean it up.
127 return commit_list_insert(one
, &result
);
130 if (repo_parse_commit(r
, one
))
132 for (i
= 0; i
< n
; i
++) {
133 if (repo_parse_commit(r
, twos
[i
]))
137 list
= paint_down_to_common(r
, one
, n
, twos
, 0);
140 struct commit
*commit
= pop_commit(&list
);
141 if (!(commit
->object
.flags
& STALE
))
142 commit_list_insert_by_date(commit
, &result
);
147 struct commit_list
*get_octopus_merge_bases(struct commit_list
*in
)
149 struct commit_list
*i
, *j
, *k
, *ret
= NULL
;
154 commit_list_insert(in
->item
, &ret
);
156 for (i
= in
->next
; i
; i
= i
->next
) {
157 struct commit_list
*new_commits
= NULL
, *end
= NULL
;
159 for (j
= ret
; j
; j
= j
->next
) {
160 struct commit_list
*bases
;
161 bases
= get_merge_bases(i
->item
, j
->item
);
166 for (k
= bases
; k
; k
= k
->next
)
174 static int remove_redundant_no_gen(struct repository
*r
,
175 struct commit
**array
, int cnt
)
177 struct commit
**work
;
178 unsigned char *redundant
;
182 work
= xcalloc(cnt
, sizeof(*work
));
183 redundant
= xcalloc(cnt
, 1);
184 ALLOC_ARRAY(filled_index
, cnt
- 1);
186 for (i
= 0; i
< cnt
; i
++)
187 repo_parse_commit(r
, array
[i
]);
188 for (i
= 0; i
< cnt
; i
++) {
189 struct commit_list
*common
;
190 timestamp_t min_generation
= commit_graph_generation(array
[i
]);
194 for (j
= filled
= 0; j
< cnt
; j
++) {
195 timestamp_t curr_generation
;
196 if (i
== j
|| redundant
[j
])
198 filled_index
[filled
] = j
;
199 work
[filled
++] = array
[j
];
201 curr_generation
= commit_graph_generation(array
[j
]);
202 if (curr_generation
< min_generation
)
203 min_generation
= curr_generation
;
205 common
= paint_down_to_common(r
, array
[i
], filled
,
206 work
, min_generation
);
207 if (array
[i
]->object
.flags
& PARENT2
)
209 for (j
= 0; j
< filled
; j
++)
210 if (work
[j
]->object
.flags
& PARENT1
)
211 redundant
[filled_index
[j
]] = 1;
212 clear_commit_marks(array
[i
], all_flags
);
213 clear_commit_marks_many(filled
, work
, all_flags
);
214 free_commit_list(common
);
217 /* Now collect the result */
218 COPY_ARRAY(work
, array
, cnt
);
219 for (i
= filled
= 0; i
< cnt
; i
++)
221 array
[filled
++] = work
[i
];
228 static int remove_redundant_with_gen(struct repository
*r
,
229 struct commit
**array
, int cnt
)
231 int i
, count_non_stale
= 0;
232 timestamp_t min_generation
= GENERATION_NUMBER_INFINITY
;
233 struct commit
**walk_start
;
234 size_t walk_start_nr
= 0, walk_start_alloc
= cnt
;
235 struct prio_queue queue
= { compare_commits_by_gen_then_commit_date
};
237 ALLOC_ARRAY(walk_start
, walk_start_alloc
);
239 /* Mark all parents of the input as STALE */
240 for (i
= 0; i
< cnt
; i
++) {
241 struct commit_list
*parents
;
242 timestamp_t generation
;
244 repo_parse_commit(r
, array
[i
]);
245 parents
= array
[i
]->parents
;
248 repo_parse_commit(r
, parents
->item
);
249 if (!(parents
->item
->object
.flags
& STALE
)) {
250 parents
->item
->object
.flags
|= STALE
;
251 ALLOC_GROW(walk_start
, walk_start_nr
+ 1, walk_start_alloc
);
252 walk_start
[walk_start_nr
++] = parents
->item
;
253 prio_queue_put(&queue
, parents
->item
);
255 parents
= parents
->next
;
258 generation
= commit_graph_generation(array
[i
]);
260 if (generation
< min_generation
)
261 min_generation
= generation
;
264 /* push the STALE bits up to min generation */
266 struct commit_list
*parents
;
267 struct commit
*c
= prio_queue_get(&queue
);
269 repo_parse_commit(r
, c
);
271 if (commit_graph_generation(c
) < min_generation
)
274 parents
= c
->parents
;
276 if (!(parents
->item
->object
.flags
& STALE
)) {
277 parents
->item
->object
.flags
|= STALE
;
278 prio_queue_put(&queue
, parents
->item
);
280 parents
= parents
->next
;
284 /* rearrange array */
285 for (i
= count_non_stale
= 0; i
< cnt
; i
++) {
286 if (!(array
[i
]->object
.flags
& STALE
))
287 array
[count_non_stale
++] = array
[i
];
291 clear_commit_marks_many(walk_start_nr
, walk_start
, STALE
);
294 return count_non_stale
;
297 static int remove_redundant(struct repository
*r
, struct commit
**array
, int cnt
)
300 * Some commit in the array may be an ancestor of
301 * another commit. Move the independent commits to the
302 * beginning of 'array' and return their number. Callers
303 * should not rely upon the contents of 'array' after
306 if (generation_numbers_enabled(r
)) {
310 * If we have a single commit with finite generation
311 * number, then the _with_gen algorithm is preferred.
313 for (i
= 0; i
< cnt
; i
++) {
314 if (commit_graph_generation(array
[i
]) < GENERATION_NUMBER_INFINITY
)
315 return remove_redundant_with_gen(r
, array
, cnt
);
319 return remove_redundant_no_gen(r
, array
, cnt
);
322 static struct commit_list
*get_merge_bases_many_0(struct repository
*r
,
325 struct commit
**twos
,
328 struct commit_list
*list
;
329 struct commit
**rslt
;
330 struct commit_list
*result
;
333 result
= merge_bases_many(r
, one
, n
, twos
);
334 for (i
= 0; i
< n
; i
++) {
338 if (!result
|| !result
->next
) {
340 clear_commit_marks(one
, all_flags
);
341 clear_commit_marks_many(n
, twos
, all_flags
);
346 /* There are more than one */
347 cnt
= commit_list_count(result
);
348 rslt
= xcalloc(cnt
, sizeof(*rslt
));
349 for (list
= result
, i
= 0; list
; list
= list
->next
)
350 rslt
[i
++] = list
->item
;
351 free_commit_list(result
);
353 clear_commit_marks(one
, all_flags
);
354 clear_commit_marks_many(n
, twos
, all_flags
);
356 cnt
= remove_redundant(r
, rslt
, cnt
);
358 for (i
= 0; i
< cnt
; i
++)
359 commit_list_insert_by_date(rslt
[i
], &result
);
364 struct commit_list
*repo_get_merge_bases_many(struct repository
*r
,
367 struct commit
**twos
)
369 return get_merge_bases_many_0(r
, one
, n
, twos
, 1);
372 struct commit_list
*repo_get_merge_bases_many_dirty(struct repository
*r
,
375 struct commit
**twos
)
377 return get_merge_bases_many_0(r
, one
, n
, twos
, 0);
380 struct commit_list
*repo_get_merge_bases(struct repository
*r
,
384 return get_merge_bases_many_0(r
, one
, 1, &two
, 1);
388 * Is "commit" a descendant of one of the elements on the "with_commit" list?
390 int repo_is_descendant_of(struct repository
*r
,
391 struct commit
*commit
,
392 struct commit_list
*with_commit
)
397 if (generation_numbers_enabled(the_repository
)) {
398 struct commit_list
*from_list
= NULL
;
400 commit_list_insert(commit
, &from_list
);
401 result
= can_all_from_reach(from_list
, with_commit
, 0);
402 free_commit_list(from_list
);
405 while (with_commit
) {
406 struct commit
*other
;
408 other
= with_commit
->item
;
409 with_commit
= with_commit
->next
;
410 if (repo_in_merge_bases_many(r
, other
, 1, &commit
))
418 * Is "commit" an ancestor of one of the "references"?
420 int repo_in_merge_bases_many(struct repository
*r
, struct commit
*commit
,
421 int nr_reference
, struct commit
**reference
)
423 struct commit_list
*bases
;
425 timestamp_t generation
, max_generation
= GENERATION_NUMBER_ZERO
;
427 if (repo_parse_commit(r
, commit
))
429 for (i
= 0; i
< nr_reference
; i
++) {
430 if (repo_parse_commit(r
, reference
[i
]))
433 generation
= commit_graph_generation(reference
[i
]);
434 if (generation
> max_generation
)
435 max_generation
= generation
;
438 generation
= commit_graph_generation(commit
);
439 if (generation
> max_generation
)
442 bases
= paint_down_to_common(r
, commit
,
443 nr_reference
, reference
,
445 if (commit
->object
.flags
& PARENT2
)
447 clear_commit_marks(commit
, all_flags
);
448 clear_commit_marks_many(nr_reference
, reference
, all_flags
);
449 free_commit_list(bases
);
454 * Is "commit" an ancestor of (i.e. reachable from) the "reference"?
456 int repo_in_merge_bases(struct repository
*r
,
457 struct commit
*commit
,
458 struct commit
*reference
)
461 struct commit_list
*list
= NULL
;
462 struct commit_list
**next
= &list
;
464 next
= commit_list_append(commit
, next
);
465 res
= repo_is_descendant_of(r
, reference
, list
);
466 free_commit_list(list
);
471 struct commit_list
*reduce_heads(struct commit_list
*heads
)
473 struct commit_list
*p
;
474 struct commit_list
*result
= NULL
, **tail
= &result
;
475 struct commit
**array
;
482 for (p
= heads
; p
; p
= p
->next
)
483 p
->item
->object
.flags
&= ~STALE
;
484 for (p
= heads
, num_head
= 0; p
; p
= p
->next
) {
485 if (p
->item
->object
.flags
& STALE
)
487 p
->item
->object
.flags
|= STALE
;
490 array
= xcalloc(num_head
, sizeof(*array
));
491 for (p
= heads
, i
= 0; p
; p
= p
->next
) {
492 if (p
->item
->object
.flags
& STALE
) {
493 array
[i
++] = p
->item
;
494 p
->item
->object
.flags
&= ~STALE
;
497 num_head
= remove_redundant(the_repository
, array
, num_head
);
498 for (i
= 0; i
< num_head
; i
++)
499 tail
= &commit_list_insert(array
[i
], tail
)->next
;
504 void reduce_heads_replace(struct commit_list
**heads
)
506 struct commit_list
*result
= reduce_heads(*heads
);
507 free_commit_list(*heads
);
511 int ref_newer(const struct object_id
*new_oid
, const struct object_id
*old_oid
)
514 struct commit
*old_commit
, *new_commit
;
515 struct commit_list
*old_commit_list
= NULL
;
519 * Both new_commit and old_commit must be commit-ish and new_commit is descendant of
520 * old_commit. Otherwise we require --force.
522 o
= deref_tag(the_repository
, parse_object(the_repository
, old_oid
),
524 if (!o
|| o
->type
!= OBJ_COMMIT
)
526 old_commit
= (struct commit
*) o
;
528 o
= deref_tag(the_repository
, parse_object(the_repository
, new_oid
),
530 if (!o
|| o
->type
!= OBJ_COMMIT
)
532 new_commit
= (struct commit
*) o
;
534 if (parse_commit(new_commit
) < 0)
537 commit_list_insert(old_commit
, &old_commit_list
);
538 ret
= repo_is_descendant_of(the_repository
,
539 new_commit
, old_commit_list
);
540 free_commit_list(old_commit_list
);
545 * Mimicking the real stack, this stack lives on the heap, avoiding stack
548 * At each recursion step, the stack items points to the commits whose
549 * ancestors are to be inspected.
551 struct contains_stack
{
553 struct contains_stack_entry
{
554 struct commit
*commit
;
555 struct commit_list
*parents
;
559 static int in_commit_list(const struct commit_list
*want
, struct commit
*c
)
561 for (; want
; want
= want
->next
)
562 if (oideq(&want
->item
->object
.oid
, &c
->object
.oid
))
568 * Test whether the candidate is contained in the list.
569 * Do not recurse to find out, though, but return -1 if inconclusive.
571 static enum contains_result
contains_test(struct commit
*candidate
,
572 const struct commit_list
*want
,
573 struct contains_cache
*cache
,
576 enum contains_result
*cached
= contains_cache_at(cache
, candidate
);
578 /* If we already have the answer cached, return that. */
583 if (in_commit_list(want
, candidate
)) {
584 *cached
= CONTAINS_YES
;
588 /* Otherwise, we don't know; prepare to recurse */
589 parse_commit_or_die(candidate
);
591 if (commit_graph_generation(candidate
) < cutoff
)
594 return CONTAINS_UNKNOWN
;
597 static void push_to_contains_stack(struct commit
*candidate
, struct contains_stack
*contains_stack
)
599 ALLOC_GROW(contains_stack
->contains_stack
, contains_stack
->nr
+ 1, contains_stack
->alloc
);
600 contains_stack
->contains_stack
[contains_stack
->nr
].commit
= candidate
;
601 contains_stack
->contains_stack
[contains_stack
->nr
++].parents
= candidate
->parents
;
604 static enum contains_result
contains_tag_algo(struct commit
*candidate
,
605 const struct commit_list
*want
,
606 struct contains_cache
*cache
)
608 struct contains_stack contains_stack
= { 0, 0, NULL
};
609 enum contains_result result
;
610 timestamp_t cutoff
= GENERATION_NUMBER_INFINITY
;
611 const struct commit_list
*p
;
613 for (p
= want
; p
; p
= p
->next
) {
614 timestamp_t generation
;
615 struct commit
*c
= p
->item
;
616 load_commit_graph_info(the_repository
, c
);
617 generation
= commit_graph_generation(c
);
618 if (generation
< cutoff
)
622 result
= contains_test(candidate
, want
, cache
, cutoff
);
623 if (result
!= CONTAINS_UNKNOWN
)
626 push_to_contains_stack(candidate
, &contains_stack
);
627 while (contains_stack
.nr
) {
628 struct contains_stack_entry
*entry
= &contains_stack
.contains_stack
[contains_stack
.nr
- 1];
629 struct commit
*commit
= entry
->commit
;
630 struct commit_list
*parents
= entry
->parents
;
633 *contains_cache_at(cache
, commit
) = CONTAINS_NO
;
637 * If we just popped the stack, parents->item has been marked,
638 * therefore contains_test will return a meaningful yes/no.
640 else switch (contains_test(parents
->item
, want
, cache
, cutoff
)) {
642 *contains_cache_at(cache
, commit
) = CONTAINS_YES
;
646 entry
->parents
= parents
->next
;
648 case CONTAINS_UNKNOWN
:
649 push_to_contains_stack(parents
->item
, &contains_stack
);
653 free(contains_stack
.contains_stack
);
654 return contains_test(candidate
, want
, cache
, cutoff
);
657 int commit_contains(struct ref_filter
*filter
, struct commit
*commit
,
658 struct commit_list
*list
, struct contains_cache
*cache
)
660 if (filter
->with_commit_tag_algo
)
661 return contains_tag_algo(commit
, list
, cache
) == CONTAINS_YES
;
662 return repo_is_descendant_of(the_repository
, commit
, list
);
665 int can_all_from_reach_with_flag(struct object_array
*from
,
666 unsigned int with_flag
,
667 unsigned int assign_flag
,
668 time_t min_commit_date
,
669 timestamp_t min_generation
)
671 struct commit
**list
= NULL
;
676 ALLOC_ARRAY(list
, from
->nr
);
678 for (i
= 0; i
< from
->nr
; i
++) {
679 struct object
*from_one
= from
->objects
[i
].item
;
681 if (!from_one
|| from_one
->flags
& assign_flag
)
684 from_one
= deref_tag(the_repository
, from_one
,
686 if (!from_one
|| from_one
->type
!= OBJ_COMMIT
) {
688 * no way to tell if this is reachable by
689 * looking at the ancestry chain alone, so
690 * leave a note to ourselves not to worry about
691 * this object anymore.
693 from
->objects
[i
].item
->flags
|= assign_flag
;
697 list
[nr_commits
] = (struct commit
*)from_one
;
698 if (parse_commit(list
[nr_commits
]) ||
699 commit_graph_generation(list
[nr_commits
]) < min_generation
) {
707 QSORT(list
, nr_commits
, compare_commits_by_gen
);
709 for (i
= 0; i
< nr_commits
; i
++) {
710 /* DFS from list[i] */
711 struct commit_list
*stack
= NULL
;
713 list
[i
]->object
.flags
|= assign_flag
;
714 commit_list_insert(list
[i
], &stack
);
717 struct commit_list
*parent
;
719 if (stack
->item
->object
.flags
& (with_flag
| RESULT
)) {
722 stack
->item
->object
.flags
|= RESULT
;
726 for (parent
= stack
->item
->parents
; parent
; parent
= parent
->next
) {
727 if (parent
->item
->object
.flags
& (with_flag
| RESULT
))
728 stack
->item
->object
.flags
|= RESULT
;
730 if (!(parent
->item
->object
.flags
& assign_flag
)) {
731 parent
->item
->object
.flags
|= assign_flag
;
733 if (parse_commit(parent
->item
) ||
734 parent
->item
->date
< min_commit_date
||
735 commit_graph_generation(parent
->item
) < min_generation
)
738 commit_list_insert(parent
->item
, &stack
);
747 if (!(list
[i
]->object
.flags
& (with_flag
| RESULT
))) {
754 clear_commit_marks_many(nr_commits
, list
, RESULT
| assign_flag
);
757 for (i
= 0; i
< from
->nr
; i
++)
758 from
->objects
[i
].item
->flags
&= ~assign_flag
;
763 int can_all_from_reach(struct commit_list
*from
, struct commit_list
*to
,
764 int cutoff_by_min_date
)
766 struct object_array from_objs
= OBJECT_ARRAY_INIT
;
767 time_t min_commit_date
= cutoff_by_min_date
? from
->item
->date
: 0;
768 struct commit_list
*from_iter
= from
, *to_iter
= to
;
770 timestamp_t min_generation
= GENERATION_NUMBER_INFINITY
;
773 add_object_array(&from_iter
->item
->object
, NULL
, &from_objs
);
775 if (!parse_commit(from_iter
->item
)) {
776 timestamp_t generation
;
777 if (from_iter
->item
->date
< min_commit_date
)
778 min_commit_date
= from_iter
->item
->date
;
780 generation
= commit_graph_generation(from_iter
->item
);
781 if (generation
< min_generation
)
782 min_generation
= generation
;
785 from_iter
= from_iter
->next
;
789 if (!parse_commit(to_iter
->item
)) {
790 timestamp_t generation
;
791 if (to_iter
->item
->date
< min_commit_date
)
792 min_commit_date
= to_iter
->item
->date
;
794 generation
= commit_graph_generation(to_iter
->item
);
795 if (generation
< min_generation
)
796 min_generation
= generation
;
799 to_iter
->item
->object
.flags
|= PARENT2
;
801 to_iter
= to_iter
->next
;
804 result
= can_all_from_reach_with_flag(&from_objs
, PARENT2
, PARENT1
,
805 min_commit_date
, min_generation
);
808 clear_commit_marks(from
->item
, PARENT1
);
813 clear_commit_marks(to
->item
, PARENT2
);
817 object_array_clear(&from_objs
);
821 struct commit_list
*get_reachable_subset(struct commit
**from
, int nr_from
,
822 struct commit
**to
, int nr_to
,
823 unsigned int reachable_flag
)
825 struct commit
**item
;
826 struct commit
*current
;
827 struct commit_list
*found_commits
= NULL
;
828 struct commit
**to_last
= to
+ nr_to
;
829 struct commit
**from_last
= from
+ nr_from
;
830 timestamp_t min_generation
= GENERATION_NUMBER_INFINITY
;
833 struct prio_queue queue
= { compare_commits_by_gen_then_commit_date
};
835 for (item
= to
; item
< to_last
; item
++) {
836 timestamp_t generation
;
837 struct commit
*c
= *item
;
840 generation
= commit_graph_generation(c
);
841 if (generation
< min_generation
)
842 min_generation
= generation
;
844 if (!(c
->object
.flags
& PARENT1
)) {
845 c
->object
.flags
|= PARENT1
;
850 for (item
= from
; item
< from_last
; item
++) {
851 struct commit
*c
= *item
;
852 if (!(c
->object
.flags
& PARENT2
)) {
853 c
->object
.flags
|= PARENT2
;
856 prio_queue_put(&queue
, *item
);
860 while (num_to_find
&& (current
= prio_queue_get(&queue
)) != NULL
) {
861 struct commit_list
*parents
;
863 if (current
->object
.flags
& PARENT1
) {
864 current
->object
.flags
&= ~PARENT1
;
865 current
->object
.flags
|= reachable_flag
;
866 commit_list_insert(current
, &found_commits
);
870 for (parents
= current
->parents
; parents
; parents
= parents
->next
) {
871 struct commit
*p
= parents
->item
;
875 if (commit_graph_generation(p
) < min_generation
)
878 if (p
->object
.flags
& PARENT2
)
881 p
->object
.flags
|= PARENT2
;
882 prio_queue_put(&queue
, p
);
886 clear_commit_marks_many(nr_to
, to
, PARENT1
);
887 clear_commit_marks_many(nr_from
, from
, PARENT2
);
889 return found_commits
;