From ebe63d826b7909b992bff988b3eac65e7b6bfa88 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Thu, 24 Sep 2015 07:43:50 -0700 Subject: [PATCH] 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 --- functions-common | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functions-common b/functions-common index cf140072fd..1ae4d6597d 100644 --- a/functions-common +++ b/functions-common @@ -492,8 +492,11 @@ function git_clone { 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 @@ function git_clone { 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