From 21a5b4ce80a03c4ec5b3397db92d732259f5de89 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 23 Sep 2024 22:16:28 +0200 Subject: [PATCH] chore: Refactor pre-commit hook to improve performance and readability --- hooks/pre-commit | 15 ++++++++++++++- other/nightly/versions.json | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 353af0e09..69a5a9d41 100644 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -4,5 +4,18 @@ if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then exec < /dev/tty fi +# Get list of stashed PHP files +stashed_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.php') + +# If there are no stashed PHP files, exit early +if [ -z "$stashed_files" ]; then + exit 0 +fi + +# Set files variable to only include stashed PHP files +files="$stashed_files" + $(pwd)/vendor/bin/pint $files -q -git add . +if [ $? -eq 0 ]; then + git add $files +fi diff --git a/other/nightly/versions.json b/other/nightly/versions.json index b7e48c698..5034c7e72 100644 --- a/other/nightly/versions.json +++ b/other/nightly/versions.json @@ -1,10 +1,10 @@ { "coolify": { "v4": { - "version": "4.0.0-beta.339" + "version": "4.0.0-beta.341" }, "nightly": { - "version": "4.0.0-beta.340" + "version": "4.0.0-beta.342" }, "helper": { "version": "1.0.1" @@ -13,4 +13,4 @@ "version": "1.0.1" } } -} \ No newline at end of file +}