Find the common ancestor for the style checking

This allows the style checker to only look at the changes done in the
current branch, and not the other commits that were done in the base
branch.
This commit is contained in:
heinrich5991 2020-09-11 00:54:47 +02:00
parent 51483c2ff1
commit b235637713
2 changed files with 3 additions and 1 deletions

View file

@ -23,5 +23,5 @@ jobs:
- name: Check style
run: |
clang-format -version
scripts/fix_style.py --dry-run --base "$(git merge-base origin/master $GITHUB_SHA)"
scripts/fix_style.py --dry-run --base origin/master
scripts/check_header_guards.py

View file

@ -43,6 +43,8 @@ def warn(changed_lines):
result = subprocess.call(["clang-format", "-Werror", "--dry-run"] + ["--lines={}:{}".format(start, end) for start, end in changed_lines[filename]] + [filename]) or result
return result
def get_common_base(base):
return subprocess.check_output(["git", "merge-base", "HEAD", base]).decode().strip()
def main():
import argparse