Skip to content

Commit 0290bf1

Browse files
committed
Revert 4b7f53d (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 <[email protected]>
1 parent 52a3e01 commit 0290bf1

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

revision.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1970,22 +1970,6 @@ static struct merge_simplify_state *locate_simplify_state(struct rev_info *revs,
19701970
return st;
19711971
}
19721972

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-
19891973
static struct commit_list **simplify_one(struct rev_info *revs, struct commit *commit, struct commit_list **tail)
19901974
{
19911975
struct commit_list *p;
@@ -2039,17 +2023,10 @@ static struct commit_list **simplify_one(struct rev_info *revs, struct commit *c
20392023
break;
20402024
}
20412025

2042-
if (revs->first_parent_only) {
2026+
if (revs->first_parent_only)
20432027
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
20512029
cnt = remove_duplicate_parents(commit);
2052-
}
20532030

20542031
/*
20552032
* It is possible that we are a merge and one side branch

t/t6012-rev-list-simplify.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,16 @@ test_expect_success setup '
7777

7878
FMT='tformat:%P %H | %s'
7979

80-
check_result () {
80+
check_outcome () {
81+
outcome=$1
82+
shift
8183
for c in $1
8284
do
8385
echo "$c"
8486
done >expect &&
8587
shift &&
8688
param="$*" &&
87-
test_expect_success "log $param" '
89+
test_expect_$outcome "log $param" '
8890
git log --pretty="$FMT" --parents $param |
8991
unnote >actual &&
9092
sed -e "s/^.* \([^ ]*\) .*/\1/" >check <actual &&
@@ -95,11 +97,15 @@ check_result () {
9597
'
9698
}
9799

100+
check_result () {
101+
check_outcome success "$@"
102+
}
103+
98104
check_result 'L K J I H G F E D C B A' --full-history
99105
check_result 'K I H E C B A' --full-history -- file
100106
check_result 'K I H E C B A' --full-history --topo-order -- file
101107
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
103109
check_result 'I B A' -- file
104110
check_result 'I B A' --topo-order -- file
105111
check_result 'H' --first-parent -- another-file

0 commit comments

Comments
 (0)