From e1290036ffd60e562aac55df083aa991ff41d03e Mon Sep 17 00:00:00 2001 From: Timur Kayumov Date: Wed, 3 Nov 2021 12:57:37 +0200 Subject: [PATCH 1/2] Fix file paths when collect changes for linting --- xcode/build_phases/swiftlint.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xcode/build_phases/swiftlint.sh b/xcode/build_phases/swiftlint.sh index 1437b19..cdefbef 100755 --- a/xcode/build_phases/swiftlint.sh +++ b/xcode/build_phases/swiftlint.sh @@ -63,10 +63,12 @@ else # Проходимся по папкам, которые требуют линтовки for SOURCE_DIR in ${SOURCES_DIRS}; do + # Путь к папке репозитория + path_prefix="`git rev-parse --show-toplevel`/" # Отбираем файлы, которые были изменены или созданы - source_unstaged_files=$(git diff --diff-filter=d --name-only ${SOURCE_DIR} | grep "\.swift$") - source_staged_files=$(git diff --diff-filter=d --name-only --cached ${SOURCE_DIR} | grep "\.swift$") + source_unstaged_files=$(git diff --diff-filter=d --name-only --line-prefix=${path_prefix} | grep "\.swift$") + source_staged_files=$(git diff --diff-filter=d --name-only --line-prefix=${path_prefix} --cached ${SOURCE_DIR} | grep "\.swift$") if [ ! -z "${source_unstaged_files}" ]; then echo "${source_unstaged_files}" >> ${lint_files_path} From c2259b12b201b31bc57d64821d0bbaac9150ff7b Mon Sep 17 00:00:00 2001 From: Timur Kayumov Date: Wed, 3 Nov 2021 13:13:00 +0200 Subject: [PATCH 2/2] Revert path argument --- xcode/build_phases/swiftlint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcode/build_phases/swiftlint.sh b/xcode/build_phases/swiftlint.sh index cdefbef..887866a 100755 --- a/xcode/build_phases/swiftlint.sh +++ b/xcode/build_phases/swiftlint.sh @@ -67,7 +67,7 @@ else path_prefix="`git rev-parse --show-toplevel`/" # Отбираем файлы, которые были изменены или созданы - source_unstaged_files=$(git diff --diff-filter=d --name-only --line-prefix=${path_prefix} | grep "\.swift$") + source_unstaged_files=$(git diff --diff-filter=d --name-only --line-prefix=${path_prefix} ${SOURCE_DIR} | grep "\.swift$") source_staged_files=$(git diff --diff-filter=d --name-only --line-prefix=${path_prefix} --cached ${SOURCE_DIR} | grep "\.swift$") if [ ! -z "${source_unstaged_files}" ]; then