From 120551da8f9b99a047d93f7bb4ca02efd4ac2520 Mon Sep 17 00:00:00 2001 From: Vladimir Makarov Date: Tue, 6 Sep 2022 13:39:11 +0500 Subject: [PATCH] `is_api_spec_under_source_control` method rewritten to return a bool value --- xcode/build_phases/api_generator.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/xcode/build_phases/api_generator.sh b/xcode/build_phases/api_generator.sh index 26210ec..ff31f91 100755 --- a/xcode/build_phases/api_generator.sh +++ b/xcode/build_phases/api_generator.sh @@ -87,15 +87,19 @@ get_api_spec_current_commit() is_api_spec_under_source_control() { + local IS_UNDER_SOURCE_CONTROL_CHECK + if [ -z "${API_SPEC_DIR}" ]; then if [ ! -z "${1}" ]; then - echo `git -C ${1} rev-parse --is-inside-work-tree 2>/dev/null` + IS_UNDER_SOURCE_CONTROL_CHECK=`git -C ${1} rev-parse --is-inside-work-tree 2>/dev/null` else - echo `git rev-parse --is-inside-work-tree 2>/dev/null` + IS_UNDER_SOURCE_CONTROL_CHECK=`git rev-parse --is-inside-work-tree 2>/dev/null` fi else - echo `git -C ${API_SPEC_DIR} rev-parse --is-inside-work-tree 2>/dev/null` + IS_UNDER_SOURCE_CONTROL_CHECK=`git -C ${API_SPEC_DIR} rev-parse --is-inside-work-tree 2>/dev/null` fi + + [ ${IS_UNDER_SOURCE_CONTROL_CHECK} = "true" ] } is_nothing_changed_since_last_check() @@ -114,7 +118,7 @@ is_nothing_changed_since_last_check() fi fi - if [ `is_api_spec_under_source_control` == "true" ]; then + if is_api_spec_under_source_control; then local -r CURRENT_COMMIT=`get_api_spec_current_commit` local -r LAST_CHECKED_COMMIT=`cat ${COMMIT_FILE_PATH} 2> /dev/null || echo ""`