clone.sh: If triggered by Gerrit plugin, use its variables
So that the script works as expected with personal fork repos, etc.
Signed-off-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Change-Id: I8fcfa09bac3bb663a534f4493cf8eef39c1b019c
diff --git a/clone.sh b/clone.sh
index c2598c1..fbb5ec2 100755
--- a/clone.sh
+++ b/clone.sh
@@ -60,7 +60,12 @@
}
# Must projects
-TFM_PROJECT="${CODE_REPO:?}"
+if [ -n "${GERRIT_EVENT_HASH}" ]; then
+ # If triggered by Gerrit, use its variables
+ TFM_PROJECT="https://${GERRIT_HOST}/${GERRIT_PROJECT}"
+else
+ TFM_PROJECT="${CODE_REPO:?}"
+fi
TFM_REFSPEC="${GERRIT_REFSPEC:?}"
TFM_NAME="trusted-firmware-m"