* In this function, passing a not NULL skipped_first is very special. * It means that we want to know if the first commit in the list is * skipped because we will want to test a commit away from it if it is * indeed skipped. * So if the first commit is skipped, we cannot take the shortcut to * just "return list" when we find the first non skipped commit, we * have to return a fully filtered
| 534 | * to 0 just before the function returns. |
| 535 | */ |
| 536 | struct commit_list *filter_skipped(struct commit_list *list, |
| 537 | struct commit_list **tried, |
| 538 | int show_all, |
| 539 | int *count, |
| 540 | int *skipped_first) |
| 541 | { |
| 542 | struct commit_list *filtered = NULL, **f = &filtered; |
| 543 | |
| 544 | *tried = NULL; |
| 545 | |
| 546 | if (skipped_first) |
| 547 | *skipped_first = 0; |
| 548 | if (count) |
| 549 | *count = 0; |
| 550 | |
| 551 | if (!skipped_revs.nr) |
| 552 | return list; |
| 553 | |
| 554 | while (list) { |
| 555 | struct commit_list *next = list->next; |
| 556 | list->next = NULL; |
| 557 | if (0 <= oid_array_lookup(&skipped_revs, &list->item->object.oid)) { |
| 558 | if (skipped_first && !*skipped_first) |
| 559 | *skipped_first = 1; |
| 560 | /* Move current to tried list */ |
| 561 | *tried = list; |
| 562 | tried = &list->next; |
| 563 | } else { |
| 564 | if (!show_all) { |
| 565 | if (!skipped_first || !*skipped_first) { |
| 566 | commit_list_free(next); |
| 567 | commit_list_free(filtered); |
| 568 | return list; |
| 569 | } |
| 570 | } else if (skipped_first && !*skipped_first) { |
| 571 | /* This means we know it's not skipped */ |
| 572 | *skipped_first = -1; |
| 573 | } |
| 574 | /* Move current to filtered list */ |
| 575 | *f = list; |
| 576 | f = &list->next; |
| 577 | if (count) |
| 578 | (*count)++; |
| 579 | } |
| 580 | list = next; |
| 581 | } |
| 582 | |
| 583 | if (skipped_first && *skipped_first == -1) |
| 584 | *skipped_first = 0; |
| 585 | |
| 586 | return filtered; |
| 587 | } |
| 588 | |
| 589 | #define PRN_MODULO 32768 |
| 590 |
no test coverage detected