Browse code

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

James E. Blair authored on 2015/09/24 23:43:50
Showing 1 changed files
... ...
@@ -492,8 +492,11 @@ function git_clone {
492 492
     if echo $git_ref | egrep -q "^refs"; then
493 493
         # If our branch name is a gerrit style refs/changes/...
494 494
         if [[ ! -d $git_dest ]]; then
495
-            [[ "$ERROR_ON_CLONE" = "True" ]] && \
495
+            if [[ "$ERROR_ON_CLONE" = "True" ]]; then
496
+                echo "The $git_dest project was not found; if this is a gate job, add"
497
+                echo "the project to the \$PROJECTS variable in the job definition."
496 498
                 die $LINENO "Cloning not allowed in this configuration"
499
+            fi
497 500
             git_timed clone $git_clone_flags $git_remote $git_dest
498 501
         fi
499 502
         cd $git_dest
... ...
@@ -501,8 +504,11 @@ function git_clone {
501 501
     else
502 502
         # do a full clone only if the directory doesn't exist
503 503
         if [[ ! -d $git_dest ]]; then
504
-            [[ "$ERROR_ON_CLONE" = "True" ]] && \
504
+            if [[ "$ERROR_ON_CLONE" = "True" ]]; then
505
+                echo "The $git_dest project was not found; if this is a gate job, add"
506
+                echo "the project to the \$PROJECTS variable in the job definition."
505 507
                 die $LINENO "Cloning not allowed in this configuration"
508
+            fi
506 509
             git_timed clone $git_clone_flags $git_remote $git_dest
507 510
             cd $git_dest
508 511
             # This checkout syntax works for both branches and tags