fix: fetch base branch before performing merge-base
Also make sure the copyright script honors the refspec that's passed on
it's command line.
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Change-Id: I91250c39015129c3c1eef0891ff55ee2ea6f74b1
diff --git a/script/static-checks/common.sh b/script/static-checks/common.sh
index 0f76b10..d7a56b7 100644
--- a/script/static-checks/common.sh
+++ b/script/static-checks/common.sh
@@ -4,11 +4,7 @@
# SPDX-License-Identifier: BSD-3-Clause
#
-function get_base_branch() {
- # Remove prefix
- echo origin/${GERRIT_BRANCH#refs/heads/}
-}
-
function get_merge_base() {
- git merge-base HEAD $(get_base_branch) | head -1
+ git fetch origin ${GERRIT_BRANCH#refs/heads/}
+ git merge-base HEAD FETCH_HEAD | head -1
}