| 456 | } |
| 457 | |
| 458 | static int remove_redundant(struct repository *r, struct commit **array, |
| 459 | size_t cnt, size_t *dedup_cnt) |
| 460 | { |
| 461 | /* |
| 462 | * Some commit in the array may be an ancestor of |
| 463 | * another commit. Move the independent commits to the |
| 464 | * beginning of 'array' and return their number. Callers |
| 465 | * should not rely upon the contents of 'array' after |
| 466 | * that number. |
| 467 | */ |
| 468 | if (generation_numbers_enabled(r)) { |
| 469 | /* |
| 470 | * If we have a single commit with finite generation |
| 471 | * number, then the _with_gen algorithm is preferred. |
| 472 | */ |
| 473 | for (size_t i = 0; i < cnt; i++) { |
| 474 | if (commit_graph_generation(array[i]) < GENERATION_NUMBER_INFINITY) |
| 475 | return remove_redundant_with_gen(r, array, cnt, dedup_cnt); |
| 476 | } |
| 477 | } |
| 478 | |
| 479 | return remove_redundant_no_gen(r, array, cnt, dedup_cnt); |
| 480 | } |
| 481 | |
| 482 | static int get_merge_bases_many_0(struct repository *r, |
| 483 | struct commit *one, |
no test coverage detected