Improve ERROR_ON_CLONE message
In case ERROR_ON_CLONE is true and triggers a failure for a missing
project, suggest a remedial action. On their own, people have
come up with remedies that include altering the value of ERROR_ON_CLONE
which rather defeats the purpose.
Change-Id: I28d7f2c184f8440b774fefaa8ec7002d6708db95
diff --git a/functions-common b/functions-common
index cf14007..1ae4d65 100644
--- a/functions-common
+++ b/functions-common
@@ -492,8 +492,11 @@
if echo $git_ref | egrep -q "^refs"; then
# If our branch name is a gerrit style refs/changes/...
if [[ ! -d $git_dest ]]; then
- [[ "$ERROR_ON_CLONE" = "True" ]] && \
+ if [[ "$ERROR_ON_CLONE" = "True" ]]; then
+ echo "The $git_dest project was not found; if this is a gate job, add"
+ echo "the project to the \$PROJECTS variable in the job definition."
die $LINENO "Cloning not allowed in this configuration"
+ fi
git_timed clone $git_clone_flags $git_remote $git_dest
fi
cd $git_dest
@@ -501,8 +504,11 @@
else
# do a full clone only if the directory doesn't exist
if [[ ! -d $git_dest ]]; then
- [[ "$ERROR_ON_CLONE" = "True" ]] && \
+ if [[ "$ERROR_ON_CLONE" = "True" ]]; then
+ echo "The $git_dest project was not found; if this is a gate job, add"
+ echo "the project to the \$PROJECTS variable in the job definition."
die $LINENO "Cloning not allowed in this configuration"
+ fi
git_timed clone $git_clone_flags $git_remote $git_dest
cd $git_dest
# This checkout syntax works for both branches and tags