From a058276b75265d49ba5cd8ca0db6d824d9d8183d Mon Sep 17 00:00:00 2001 From: P-A Loizeau <p.-a.loizeau@gsi.de> Date: Thu, 3 Dec 2020 17:52:33 +0100 Subject: [PATCH] In check format scripts, move argument number check to top --- scripts/check-apply-format-changes.sh | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/check-apply-format-changes.sh b/scripts/check-apply-format-changes.sh index ebe6fbc1eb..12f8a017e9 100755 --- a/scripts/check-apply-format-changes.sh +++ b/scripts/check-apply-format-changes.sh @@ -1,5 +1,12 @@ #!/bin/bash +if [[ $# -ne 1 ]]; then + echo "Missing argument! please call this script with either the check or apply argument:" + echo "./scripts/check-apply-format-changes.sh check" + echo "./scripts/check-apply-format-changes.sh apply" + exit -1 +fi + if [[ -z $GIT_CLANG_FORMAT_BIN || -z $CLANG_FORMAT_BIN ]]; then echo "Error: GIT_CLANG_FORMAT_BIN or CLANG_FORMAT_BIN not defined" echo "=> Please follow the instruction at https://redmine.cbm.gsi.de/projects/cbmroot/wiki/Clang-format" @@ -28,13 +35,6 @@ echo "Upstream name is :" $UPSTREAM BASE_COMMIT=$UPSTREAM/master CHANGED_FILES=$(git diff --name-only $BASE_COMMIT | grep -E '.*\.(h|hpp|c|C|cpp|cxx|tpl)$' | grep -viE '.*LinkDef.h$') -if [[ $# -ne 1 ]]; then - echo "Missing argument! please call this script with either the check or apply argument:" - echo "./scripts/check-apply-format-changes.sh check" - echo "./scripts/check-apply-format-changes.sh apply" - exit -1 -fi - case $1 in check) echo "Checking if there are format changes required" -- GitLab