| 191 | } |
| 192 | |
| 193 | static int merge_bases_many(struct repository *r, |
| 194 | struct commit *one, int n, |
| 195 | struct commit **twos, |
| 196 | enum merge_base_flags mb_flags, |
| 197 | struct commit_list **result) |
| 198 | { |
| 199 | struct commit_list *list = NULL, **tail = result; |
| 200 | int i; |
| 201 | |
| 202 | for (i = 0; i < n; i++) { |
| 203 | if (one == twos[i]) { |
| 204 | /* |
| 205 | * We do not mark this even with RESULT so we do not |
| 206 | * have to clean it up. |
| 207 | */ |
| 208 | *result = commit_list_insert(one, result); |
| 209 | return 0; |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | if (!one) |
| 214 | return 0; |
| 215 | if (repo_parse_commit(r, one)) |
| 216 | return error(_("could not parse commit %s"), |
| 217 | oid_to_hex(&one->object.oid)); |
| 218 | for (i = 0; i < n; i++) { |
| 219 | if (!twos[i]) |
| 220 | return 0; |
| 221 | if (repo_parse_commit(r, twos[i])) |
| 222 | return error(_("could not parse commit %s"), |
| 223 | oid_to_hex(&twos[i]->object.oid)); |
| 224 | } |
| 225 | |
| 226 | if (paint_down_to_common(r, one, n, twos, 0, mb_flags, &list)) { |
| 227 | commit_list_free(list); |
| 228 | return -1; |
| 229 | } |
| 230 | |
| 231 | while (list) { |
| 232 | struct commit *commit = pop_commit(&list); |
| 233 | if (!(commit->object.flags & STALE)) |
| 234 | tail = commit_list_append(commit, tail); |
| 235 | } |
| 236 | commit_list_sort_by_date(result); |
| 237 | return 0; |
| 238 | } |
| 239 | |
| 240 | int get_octopus_merge_bases(struct commit_list *in, struct commit_list **result) |
| 241 | { |
no test coverage detected