Fix ancestor check

Before, for the common case that the actual_merge_base was already set
as base, the check for is_ancestor(base, actual_merge_base) would have
caused the base to be re-set.
This is a writing operation, which causes trouble e.g. for the parallel
operation of 'git cl status'.

R=iannucci@chromium.org, tandrii@chromium.org
BUG=

Review URL: https://codereview.chromium.org/1888213004

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@300003 0039d316-1c4b-4281-b951-d872f2087c98
changes/60/343160/1
clemensh@chromium.org 9 years ago
parent 0b2d70724f
commit c3fe99d8b9

@ -437,7 +437,7 @@ def get_or_create_merge_base(branch, parent=None):
def is_ancestor(a, b):
return run_with_retcode('merge-base', '--is-ancestor', a, b) == 0
if base:
if base and base != actual_merge_base:
if not is_ancestor(base, branch):
logging.debug('Found WRONG pre-set merge-base for %s: %s', branch, base)
base = None

Loading…
Cancel
Save