* Step 7, reachability test on "ours" at commit level */
| 811 | * Step 7, reachability test on "ours" at commit level |
| 812 | */ |
| 813 | static void post_assign_shallow(struct shallow_info *info, |
| 814 | struct ref_bitmap *ref_bitmap, |
| 815 | int *ref_status) |
| 816 | { |
| 817 | struct object_id *oid = info->shallow->oid; |
| 818 | struct commit *c; |
| 819 | uint32_t **bitmap; |
| 820 | size_t dst, i, j; |
| 821 | size_t bitmap_nr = DIV_ROUND_UP(info->ref->nr, 32); |
| 822 | struct commit_stack cs = COMMIT_STACK_INIT; |
| 823 | |
| 824 | trace_printf_key(&trace_shallow, "shallow: post_assign_shallow\n"); |
| 825 | if (ref_status) |
| 826 | MEMZERO_ARRAY(ref_status, info->ref->nr); |
| 827 | |
| 828 | /* Remove unreachable shallow commits from "theirs" */ |
| 829 | for (i = dst = 0; i < info->nr_theirs; i++) { |
| 830 | if (i != dst) |
| 831 | info->theirs[dst] = info->theirs[i]; |
| 832 | c = lookup_commit(the_repository, &oid[info->theirs[i]]); |
| 833 | bitmap = ref_bitmap_at(ref_bitmap, c); |
| 834 | if (!*bitmap) |
| 835 | continue; |
| 836 | for (j = 0; j < bitmap_nr; j++) |
| 837 | if (bitmap[0][j]) { |
| 838 | update_refstatus(ref_status, info->ref->nr, *bitmap); |
| 839 | dst++; |
| 840 | break; |
| 841 | } |
| 842 | } |
| 843 | info->nr_theirs = dst; |
| 844 | |
| 845 | refs_head_ref(get_main_ref_store(the_repository), add_ref, &cs); |
| 846 | refs_for_each_ref(get_main_ref_store(the_repository), add_ref, &cs); |
| 847 | |
| 848 | /* Remove unreachable shallow commits from "ours" */ |
| 849 | for (i = dst = 0; i < info->nr_ours; i++) { |
| 850 | if (i != dst) |
| 851 | info->ours[dst] = info->ours[i]; |
| 852 | c = lookup_commit(the_repository, &oid[info->ours[i]]); |
| 853 | bitmap = ref_bitmap_at(ref_bitmap, c); |
| 854 | if (!*bitmap) |
| 855 | continue; |
| 856 | for (j = 0; j < bitmap_nr; j++) |
| 857 | if (bitmap[0][j]) { |
| 858 | /* Step 7, reachability test at commit level */ |
| 859 | int ret = repo_in_merge_bases_many(the_repository, c, cs.nr, cs.items, 1); |
| 860 | if (ret < 0) |
| 861 | exit(128); |
| 862 | if (!ret) { |
| 863 | update_refstatus(ref_status, info->ref->nr, *bitmap); |
| 864 | dst++; |
| 865 | break; |
| 866 | } |
| 867 | } |
| 868 | } |
| 869 | info->nr_ours = dst; |
| 870 |
no test coverage detected