| 1436 | } |
| 1437 | |
| 1438 | static int limit_list(struct rev_info *revs) |
| 1439 | { |
| 1440 | int slop = SLOP; |
| 1441 | timestamp_t date = TIME_MAX; |
| 1442 | struct commit_list *original_list = revs->commits; |
| 1443 | struct commit_list *newlist = NULL; |
| 1444 | struct commit_list **p = &newlist; |
| 1445 | struct commit *interesting_cache = NULL; |
| 1446 | struct prio_queue queue = { .compare = compare_commits_by_commit_date }; |
| 1447 | |
| 1448 | if (revs->ancestry_path_implicit_bottoms) { |
| 1449 | collect_bottom_commits(original_list, |
| 1450 | &revs->ancestry_path_bottoms); |
| 1451 | if (!revs->ancestry_path_bottoms) |
| 1452 | die("--ancestry-path given but there are no bottom commits"); |
| 1453 | } |
| 1454 | |
| 1455 | while (original_list) { |
| 1456 | struct commit *commit = pop_commit(&original_list); |
| 1457 | prio_queue_put(&queue, commit); |
| 1458 | } |
| 1459 | |
| 1460 | while (queue.nr) { |
| 1461 | struct commit *commit = prio_queue_get(&queue); |
| 1462 | struct object *obj = &commit->object; |
| 1463 | |
| 1464 | if (commit == interesting_cache) |
| 1465 | interesting_cache = NULL; |
| 1466 | |
| 1467 | if (revs->max_age != -1 && (commit->date < revs->max_age)) |
| 1468 | obj->flags |= UNINTERESTING; |
| 1469 | if (process_parents(revs, commit, &queue) < 0) { |
| 1470 | clear_prio_queue(&queue); |
| 1471 | return -1; |
| 1472 | } |
| 1473 | if (obj->flags & UNINTERESTING) { |
| 1474 | mark_parents_uninteresting(revs, commit); |
| 1475 | slop = still_interesting(&queue, date, slop, &interesting_cache); |
| 1476 | if (slop) |
| 1477 | continue; |
| 1478 | break; |
| 1479 | } |
| 1480 | if (revs->min_age != -1 && (commit->date > revs->min_age) && |
| 1481 | !revs->line_level_traverse) |
| 1482 | continue; |
| 1483 | if (revs->max_age_as_filter != -1 && |
| 1484 | (commit->date < revs->max_age_as_filter) && !revs->line_level_traverse) |
| 1485 | continue; |
| 1486 | date = commit->date; |
| 1487 | p = &commit_list_insert(commit, p)->next; |
| 1488 | } |
| 1489 | if (revs->cherry_pick || revs->cherry_mark) |
| 1490 | cherry_pick_list(newlist, revs); |
| 1491 | |
| 1492 | if (revs->left_only || revs->right_only) |
| 1493 | limit_left_right(newlist, revs); |
| 1494 | |
| 1495 | if (revs->ancestry_path) |
no test coverage detected