| 3315 | } |
| 3316 | |
| 3317 | static int remove_duplicate_parents(struct rev_info *revs, struct commit *commit) |
| 3318 | { |
| 3319 | struct treesame_state *ts = lookup_decoration(&revs->treesame, &commit->object); |
| 3320 | struct commit_list **pp, *p; |
| 3321 | int surviving_parents; |
| 3322 | |
| 3323 | /* Examine existing parents while marking ones we have seen... */ |
| 3324 | pp = &commit->parents; |
| 3325 | surviving_parents = 0; |
| 3326 | while ((p = *pp) != NULL) { |
| 3327 | struct commit *parent = p->item; |
| 3328 | if (parent->object.flags & TMP_MARK) { |
| 3329 | *pp = p->next; |
| 3330 | free(p); |
| 3331 | if (ts) |
| 3332 | compact_treesame(revs, commit, surviving_parents); |
| 3333 | continue; |
| 3334 | } |
| 3335 | parent->object.flags |= TMP_MARK; |
| 3336 | surviving_parents++; |
| 3337 | pp = &p->next; |
| 3338 | } |
| 3339 | /* clear the temporary mark */ |
| 3340 | for (p = commit->parents; p; p = p->next) { |
| 3341 | p->item->object.flags &= ~TMP_MARK; |
| 3342 | } |
| 3343 | /* no update_treesame() - removing duplicates can't affect TREESAME */ |
| 3344 | return surviving_parents; |
| 3345 | } |
| 3346 | |
| 3347 | struct merge_simplify_state { |
| 3348 | struct commit *simplified; |
no test coverage detected