Merge branch 'jc/remove-treesame-parent-in-simplify-merges'
authorJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2013 21:37:53 +0000 (28 14:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2013 21:37:53 +0000 (28 14:37 -0700)
The --simplify-merges logic did not cull irrelevant parents from a
merge that is otherwise not interesting with respect to the paths
we are following.

This touches a fairly core part of the revision traversal
infrastructure; even though I think this change is correct, please
report immediately if you find any unintended side effect.

* jc/remove-treesame-parent-in-simplify-merges:
  simplify-merges: drop merge from irrelevant side branch

1  2 
revision.c
t/t6012-rev-list-simplify.sh

diff --cc revision.c
@@@ -2019,13 -1484,15 +2035,21 @@@ static struct commit_list **simplify_on
        for (p = commit->parents; p; p = p->next) {
                pst = locate_simplify_state(revs, p->item);
                p->item = pst->simplified;
 +              if (revs->first_parent_only)
 +                      break;
        }
-       if (!revs->first_parent_only)
-               cnt = remove_duplicate_parents(commit);
-       else
 -      /*
 -       * A merge with a tree-same parent is useless
 -       */
 -      if (commit->parents && commit->parents->next)
 -              remove_treesame_parents(commit);
++      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);
 -      cnt = remove_duplicate_parents(commit);
++              cnt = remove_duplicate_parents(commit);
++      }
  
        /*
         * It is possible that we are a merge and one side branch
Simple merge