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

Cherry-pick: Fixed conflicts while applying to lts-v2.10 branch.

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 9447c44..90f6cb4 100755
--- a/script/static-checks/static-checks-coding-style.sh
+++ b/script/static-checks/static-checks-coding-style.sh
@@ -9,7 +9,11 @@
 # against the Linux coding style using the checkpatch.pl script from
 # the Linux kernel source tree.
 
-TEST_CASE="Codestyle on the entire patch chain"
+this_dir="$(readlink -f "$(dirname "$0")")"
+. $this_dir/common.sh
+
+
+TEST_CASE="Coding style on current patch"
 
 echo "# $TEST_CASE"
 
@@ -21,7 +25,7 @@
 chmod +x $CI_ROOT/script/static-checks/checkpatch.pl
 
 CHECKPATCH=$CI_ROOT/script/static-checks/checkpatch.pl \
-  make checkpatch BASE_COMMIT=origin/$TF_GERRIT_BRANCH &> "$LOG_FILE"
+  make checkpatch BASE_COMMIT=$(get_merge_base) &> "$LOG_FILE"
 RES=$?
 
 if [[ "$RES" == 0 ]]; then