From 885330b8e7795a6750c668e7abd862e071bf4642 Mon Sep 17 00:00:00 2001 From: Thierry Carrez Date: Tue, 5 Jan 2021 15:25:03 +0100 Subject: [PATCH] release-scripts: Remove misleading error message In the normal course of script execution, clone_repo.sh routinely logs the following error message: error: pathspec 'xxx' did not match any file(s) known to git This error can be safely ignored, as the script moves on to checking out master instead. But it can be (and has been) mistakenly interpreted as the reason why the script fails. This change avoids logging the error message and logs a clearer explanation instead. Change-Id: Iaaaed7b0ea343bd81b8ad898654658545942a3d0 --- .../files/release-tools/clone_repo.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/roles/copy-release-tools-scripts/files/release-tools/clone_repo.sh b/roles/copy-release-tools-scripts/files/release-tools/clone_repo.sh index 5c11316c25..9096b5e610 100755 --- a/roles/copy-release-tools-scripts/files/release-tools/clone_repo.sh +++ b/roles/copy-release-tools-scripts/files/release-tools/clone_repo.sh @@ -194,6 +194,7 @@ else # directory already existed we might have checked out something else # before so just do it again). (cd $local_dir && - (git checkout $BRANCH || git checkout master) && - retry git pull --ff-only) + (git checkout $BRANCH 2>/dev/null || + (echo "No $BRANCH, checking out master"; git checkout master)) && + retry git pull --ff-only) fi