| 1043 | } |
| 1044 | |
| 1045 | void bitmap_writer_select_commits(struct bitmap_writer *writer, |
| 1046 | struct commit **indexed_commits, |
| 1047 | unsigned int indexed_commits_nr) |
| 1048 | { |
| 1049 | unsigned int i = 0, j, next; |
| 1050 | |
| 1051 | QSORT(indexed_commits, indexed_commits_nr, date_compare); |
| 1052 | |
| 1053 | if (indexed_commits_nr < 100) { |
| 1054 | for (i = 0; i < indexed_commits_nr; ++i) |
| 1055 | bitmap_writer_push_commit(writer, indexed_commits[i], 0); |
| 1056 | |
| 1057 | select_pseudo_merges(writer); |
| 1058 | |
| 1059 | return; |
| 1060 | } |
| 1061 | |
| 1062 | if (writer->show_progress) |
| 1063 | writer->progress = start_progress(writer->repo, |
| 1064 | "Selecting bitmap commits", 0); |
| 1065 | |
| 1066 | for (;;) { |
| 1067 | struct commit *chosen = NULL; |
| 1068 | |
| 1069 | next = next_commit_index(i); |
| 1070 | |
| 1071 | if (i + next >= indexed_commits_nr) |
| 1072 | break; |
| 1073 | |
| 1074 | if (next == 0) { |
| 1075 | chosen = indexed_commits[i]; |
| 1076 | } else { |
| 1077 | chosen = indexed_commits[i + next]; |
| 1078 | |
| 1079 | for (j = 0; j <= next; ++j) { |
| 1080 | struct commit *cm = indexed_commits[i + j]; |
| 1081 | |
| 1082 | if ((cm->object.flags & NEEDS_BITMAP) != 0) { |
| 1083 | chosen = cm; |
| 1084 | break; |
| 1085 | } |
| 1086 | |
| 1087 | if (cm->parents && cm->parents->next) |
| 1088 | chosen = cm; |
| 1089 | } |
| 1090 | } |
| 1091 | |
| 1092 | bitmap_writer_push_commit(writer, chosen, 0); |
| 1093 | |
| 1094 | i += next + 1; |
| 1095 | display_progress(writer->progress, i); |
| 1096 | } |
| 1097 | |
| 1098 | stop_progress(&writer->progress); |
| 1099 | |
| 1100 | select_pseudo_merges(writer); |
| 1101 | } |
| 1102 |
no test coverage detected