diff --git a/revision.c b/revision.c index 71e62d8312..eb98128868 100644 --- a/revision.c +++ b/revision.c @@ -1970,22 +1970,6 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs, return st; } -static void remove_treesame_parents(struct commit *commit) -{ - struct commit_list **pp, *p; - - pp = &commit->parents; - while ((p = *pp) != NULL) { - struct commit *parent = p->item; - if (parent->object.flags & TREESAME) { - *pp = p->next; - free(p); - continue; - } - pp = &p->next; - } -} - static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail) { struct commit_list *p; @@ -2039,17 +2023,10 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c break; } - if (revs->first_parent_only) { + if (revs->first_parent_only) cnt = 1; - } else { - /* - * A merge with a tree-same parent is useless - */ - if (commit->parents && commit->parents->next) - remove_treesame_parents(commit); - + else cnt = remove_duplicate_parents(commit); - } /* * It is possible that we are a merge and one side branch diff --git a/t/t6012-rev-list-simplify.sh b/t/t6012-rev-list-simplify.sh index 8e2ff13423..dd6dc844e7 100755 --- a/t/t6012-rev-list-simplify.sh +++ b/t/t6012-rev-list-simplify.sh @@ -77,14 +77,16 @@ test_expect_success setup ' FMT='tformat:%P %H | %s' -check_result () { +check_outcome () { + outcome=$1 + shift for c in $1 do echo "$c" done >expect && shift && param="$*" && - test_expect_success "log $param" ' + test_expect_$outcome "log $param" ' git log --pretty="$FMT" --parents $param | unnote >actual && sed -e "s/^.* \([^ ]*\) .*/\1/" >check