fix: fetch entire change and integration history
Fetching with a specific depth is insufficient and finding the
merge-base is still prone to fail because Git can't resolve the history
between the grafted refspec we start with and whatever the integration
branch is.
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
Change-Id: Ie70905f6f5c651022b3ff9e1e56d2eb2177ed7ce
(cherry picked from commit afdcff720185959585c2a1ef970f2caa755e6682)
diff --git a/script/static-checks/common.sh b/script/static-checks/common.sh
index d7a56b7..a2793b7 100644
--- a/script/static-checks/common.sh
+++ b/script/static-checks/common.sh
@@ -5,6 +5,6 @@
#
function get_merge_base() {
- git fetch origin ${GERRIT_BRANCH#refs/heads/}
+ git fetch --unshallow origin ${GERRIT_BRANCH#refs/heads/}
git merge-base HEAD FETCH_HEAD | head -1
}
diff --git a/script/static-checks/static-checks.sh b/script/static-checks/static-checks.sh
index 1424349..5e9edbb 100755
--- a/script/static-checks/static-checks.sh
+++ b/script/static-checks/static-checks.sh
@@ -30,7 +30,7 @@
fi
fi
- git fetch --depth=100 origin "$GERRIT_REFSPEC"
+ git fetch --unshallow --update-shallow origin "$GERRIT_REFSPEC"
git checkout FETCH_HEAD
merge_base=$(get_merge_base)