static-checks: Use proper ref branch when collecting commits to test

Use the actual branch specified in the CI run, instead of hardcoded
master/integration.

Addresses https://linaro.atlassian.net/browse/TFC-636

Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: Ic0fd0677978f226626d567108f17ccb864aa8095
diff --git a/script/static-checks/static-checks-coding-style.sh b/script/static-checks/static-checks-coding-style.sh
index 6d2ce79..4483b15 100755
--- a/script/static-checks/static-checks-coding-style.sh
+++ b/script/static-checks/static-checks-coding-style.sh
@@ -9,6 +9,10 @@
 # against the Linux coding style using the checkpatch.pl script from
 # the Linux kernel source tree.
 
+this_dir="$(readlink -f "$(dirname "$0")")"
+. $this_dir/common.sh
+
+
 TEST_CASE="Coding style on current patch"
 
 echo "# Check coding style on the last patch"
@@ -17,15 +21,10 @@
 
 LOG_FILE=$(mktemp -t coding-style-check.XXXX)
 
-# Make the patch against the specified remote branch
-if [ -n "$CODING_STYLE_BASE_BRANCH" ]; then
-	BASE_COMMIT="BASE_COMMIT=$CODING_STYLE_BASE_BRANCH"
-fi
-
 chmod +x $CI_ROOT/script/static-checks/checkpatch.pl
 
 CHECKPATCH=$CI_ROOT/script/static-checks/checkpatch.pl \
-  make checkpatch &> "$LOG_FILE"
+  make checkpatch BASE_COMMIT=$(get_merge_base) &> "$LOG_FILE"
 RES=$?
 
 if [[ "$RES" == 0 ]]; then