Revert 4b7f53da7618 (simplify-merges: drop merge from irrelevant side branch, 2013-01-17)

Kevin Bracey reports that the change regresses a case shown in the user manual. Trading one fix with another breakage is not worth it. Just keep the test to document the existing breakage, and revert the change for now. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Apr 8, 2013 at 13:10 UTC 0290bf1250533442aa870d303e56745388d562c2
2 files changed +11 -28
revision.c
+2 -25
@@ -1970,22 +1970,6 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs,
1970 return st;
1971 }
1972
1973 -static void remove_treesame_parents(struct commit *commit)
1974 -{
1975 - struct commit_list **pp, *p;
1976 -
1977 - pp = &commit->parents;
1978 - while ((p = *pp) != NULL) {
1979 - struct commit *parent = p->item;
1980 - if (parent->object.flags & TREESAME) {
1981 - *pp = p->next;
1982 - free(p);
1983 - continue;
1984 - }
1985 - pp = &p->next;
1986 - }
1987 -}
1988 -
1973 static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail)
1974 {
1975 struct commit_list *p;
@@ -2039,17 +2023,10 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c
2023 break;
2024 }
2025
2042 - if (revs->first_parent_only) {
2026 + if (revs->first_parent_only)
2027 cnt = 1;
2044 - } else {
2045 - /*
2046 - * A merge with a tree-same parent is useless
2047 - */
2048 - if (commit->parents && commit->parents->next)
2049 - remove_treesame_parents(commit);
2050 -
2028 + else
2029 cnt = remove_duplicate_parents(commit);
2052 - }
2030
2031 /*
2032 * It is possible that we are a merge and one side branch
t/t6012-rev-list-simplify.sh
+9 -3
@@ -77,14 +77,16 @@ test_expect_success setup '
77
78 FMT='tformat:%P %H | %s'
79
80 -check_result () {
80 +check_outcome () {
81 + outcome=$1
82 + shift
83 for c in $1
84 do
85 echo "$c"
86 done >expect &&
87 shift &&
88 param="$*" &&
87 - test_expect_success "log $param" '
89 + test_expect_$outcome "log $param" '
90 git log --pretty="$FMT" --parents $param |
91 unnote >actual &&
92 sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
@@ -95,11 +97,15 @@ check_result () {
97 '
98 }
99
100 +check_result () {
101 + check_outcome success "$@"
102 +}
103 +
104 check_result 'L K J I H G F E D C B A' --full-history
105 check_result 'K I H E C B A' --full-history -- file
106 check_result 'K I H E C B A' --full-history --topo-order -- file
107 check_result 'K I H E C B A' --full-history --date-order -- file
102 -check_result 'I E C B A' --simplify-merges -- file
108 +check_outcome failure 'I E C B A' --simplify-merges -- file
109 check_result 'I B A' -- file
110 check_result 'I B A' --topo-order -- file
111 check_result 'H' --first-parent -- another-file