From 6c7e07a3afc8189b913087fdc91bb3e91c9a92a0 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 29 Oct 2017 16:42:20 +0100 Subject: [PATCH] Improve detection of merge commits This looks at the commit parents instead of parsing the Git commit subject. --- codecov/__init__.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/codecov/__init__.py b/codecov/__init__.py index cedb314b..a76a837c 100644 --- a/codecov/__init__.py +++ b/codecov/__init__.py @@ -31,8 +31,6 @@ remove_token = re.compile(r'token=[^\&]+').sub -is_merge_commit = re.compile(r'^Merge\s\w{40}\sinto\s\w{40}$') - ignored_path = re.compile(r'(/vendor)|' r'(/js/generated/coverage)|' r'(/__pycache__)|' @@ -530,9 +528,11 @@ def main(*argv, **kwargs): else: # Merge Commits # ------------- - res = try_to_run('git log -1 --pretty=%B') - if res and is_merge_commit.match(res.strip()): - query['commit'] = res.split(' ')[1] + res = try_to_run('git show --no-patch --format="%P"') + if res: + heads = res.split(' ') + if len(heads) > 1: + query['commit'] = heads[0] if codecov.slug: query['slug'] = codecov.slug