Skip to content

Commit

Permalink
Revert 4b7f53d (simplify-merges: drop merge from irrelevant side bran…
Browse files Browse the repository at this point in the history
…ch, 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>
  • Loading branch information
Junio C Hamano committed Apr 8, 2013
1 parent 52a3e01 commit 0290bf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
27 changes: 2 additions & 25 deletions revision.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions t/t6012-rev-list-simplify.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <actual &&
Expand All @@ -95,11 +97,15 @@ check_result () {
'
}

check_result () {
check_outcome success "$@"
}

check_result 'L K J I H G F E D C B A' --full-history
check_result 'K I H E C B A' --full-history -- file
check_result 'K I H E C B A' --full-history --topo-order -- file
check_result 'K I H E C B A' --full-history --date-order -- file
check_result 'I E C B A' --simplify-merges -- file
check_outcome failure 'I E C B A' --simplify-merges -- file
check_result 'I B A' -- file
check_result 'I B A' --topo-order -- file
check_result 'H' --first-parent -- another-file
Expand Down

0 comments on commit 0290bf1

Please sign in to comment.