Skip to content

Commit

Permalink
chore: pre-commit 스크립트 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
nove1080 committed Sep 19, 2024
1 parent ad97101 commit 8c48107
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions scripts/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

#1. 변경된 파일들 이름만 추출하여 저장
stagedFiles=$(git diff --staged --name-only)
#2. SpotlessApply 실행
echo "Running spotlessApply. Formatting code..."
./gradlew spotlessApply
#3. 변경사항이 발생한 파일들 다시 git add
for file in $stagedFiles; do
if test -f "$file"; then
git add "$file"
fi
done

0 comments on commit 8c48107

Please sign in to comment.