static-checks: use origin/master instead of master as base branch
In some CI testing scenarios, there are no local branches, just remotes, so
as a safer approach, use 'origin/master' instead of 'master'. Base
branch is used to find common parent ancestor between
base (origin/master) and user patchset's (FETCH_HEAD) branches.
Change-Id: I36940ac043f45bda6b94e8787b29f319a5f4acba
Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
diff --git a/script/static-checks/check-banned-api.py b/script/static-checks/check-banned-api.py
index 0bfadeb..931b1bd 100755
--- a/script/static-checks/check-banned-api.py
+++ b/script/static-checks/check-banned-api.py
@@ -168,7 +168,7 @@
help="""
Base commit in patch mode (default: %(default)s)
""",
- default="master")
+ default="origin/master")
parser.add_argument("--to-ref",
help="""
Final commit in patch mode (default: %(default)s)
diff --git a/script/static-checks/check-copyright.py b/script/static-checks/check-copyright.py
index 39863c7..d99aa5d 100755
--- a/script/static-checks/check-copyright.py
+++ b/script/static-checks/check-copyright.py
@@ -180,7 +180,7 @@
only files that are modified by the latest patch(es).""",
action="store_true")
- (rc, stdout, stderr) = utils.shell_command(['git', 'merge-base', 'HEAD', 'master'])
+ (rc, stdout, stderr) = utils.shell_command(['git', 'merge-base', 'HEAD', 'origin/master'])
if rc:
print("Git merge-base command failed. Cannot determine base commit.")
sys.exit(rc)
diff --git a/script/static-checks/check-include-order.py b/script/static-checks/check-include-order.py
index 4f605f3..6a3a5a3 100755
--- a/script/static-checks/check-include-order.py
+++ b/script/static-checks/check-include-order.py
@@ -223,7 +223,7 @@
parser.add_argument(
"--from-ref",
help="Base commit in patch mode (default: %(default)s)",
- default="master",
+ default="origin/master",
)
parser.add_argument(
"--to-ref",
diff --git a/script/static-checks/static-checks-coding-style-line-endings.sh b/script/static-checks/static-checks-coding-style-line-endings.sh
index 5442f7d..bd31e2d 100755
--- a/script/static-checks/static-checks-coding-style-line-endings.sh
+++ b/script/static-checks/static-checks-coding-style-line-endings.sh
@@ -15,7 +15,7 @@
if [[ "$2" == "patch" ]]; then
cd "$1"
- parent=$(git merge-base HEAD master | head -1)
+ parent=$(git merge-base HEAD origin/master | head -1)
git diff ${parent}..HEAD --no-ext-diff --unified=0 --exit-code -a --no-prefix | grep -E "^\+" | \
grep --files-with-matches $'\r$' &> "$LOG_FILE"
else