Fix file paths when collect changes for linting

This commit is contained in:
Timur Kayumov 2021-11-03 12:57:37 +02:00
parent b9b7dfe3f7
commit e1290036ff
1 changed files with 4 additions and 2 deletions

View File

@ -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}