]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'jc/remove-treesame-parent-in-simplify-merges'
authorJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2013 21:37:53 +0000 (14:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 28 Mar 2013 21:37:53 +0000 (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
index ef6020541282770b9edc4c921cadb7ab1506da56,3536635a887c3c6c43cdc5c6d280a98d174b4a81..78397d6486203a6b7242c8ea866780979876e685
@@@ -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