MCPcopy Create free account
hub / github.com/git/git / remove_duplicate_parents

Function remove_duplicate_parents

revision.c:3317–3345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3315}
3316
3317static 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
3347struct merge_simplify_state {
3348 struct commit *simplified;

Callers 2

simplify_oneFunction · 0.85
rewrite_parentsFunction · 0.85

Calls 2

lookup_decorationFunction · 0.85
compact_treesameFunction · 0.85

Tested by

no test coverage detected