Skip to content

Commit 21a5b4c

Browse files
committed
chore: Refactor pre-commit hook to improve performance and readability
1 parent 12a0d71 commit 21a5b4c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

hooks/pre-commit

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,18 @@ if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
44
exec < /dev/tty
55
fi
66

7+
# Get list of stashed PHP files
8+
stashed_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.php')
9+
10+
# If there are no stashed PHP files, exit early
11+
if [ -z "$stashed_files" ]; then
12+
exit 0
13+
fi
14+
15+
# Set files variable to only include stashed PHP files
16+
files="$stashed_files"
17+
718
$(pwd)/vendor/bin/pint $files -q
8-
git add .
19+
if [ $? -eq 0 ]; then
20+
git add $files
21+
fi

other/nightly/versions.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"coolify": {
33
"v4": {
4-
"version": "4.0.0-beta.339"
4+
"version": "4.0.0-beta.341"
55
},
66
"nightly": {
7-
"version": "4.0.0-beta.340"
7+
"version": "4.0.0-beta.342"
88
},
99
"helper": {
1010
"version": "1.0.1"
@@ -13,4 +13,4 @@
1313
"version": "1.0.1"
1414
}
1515
}
16-
}
16+
}

0 commit comments

Comments
 (0)