From 8c48107b3cccbdd832b4b7b5677383e3b9f833df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=82=98=EC=A0=9C=EB=B2=95?= Date: Thu, 19 Sep 2024 22:22:23 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20pre-commit=20=EC=8A=A4=ED=81=AC?= =?UTF-8?q?=EB=A6=BD=ED=8A=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/pre-commit | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/pre-commit diff --git a/scripts/pre-commit b/scripts/pre-commit new file mode 100644 index 00000000..706c7654 --- /dev/null +++ b/scripts/pre-commit @@ -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 \ No newline at end of file