From ec494d934f12183d1fc0270b733d383d5107c283 Mon Sep 17 00:00:00 2001 From: Oliver Davies Date: Sat, 26 Aug 2023 23:05:51 +0100 Subject: [PATCH] fix(git-hooks): always create the commit msg hook --- src/Action/CreateListOfFilesToGenerate.php | 6 ++++++ templates/justfile.twig | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Action/CreateListOfFilesToGenerate.php b/src/Action/CreateListOfFilesToGenerate.php index 2652ac7..c815fce 100644 --- a/src/Action/CreateListOfFilesToGenerate.php +++ b/src/Action/CreateListOfFilesToGenerate.php @@ -113,6 +113,12 @@ final class CreateListOfFilesToGenerate ); } + $filesToGenerate[] = new TemplateFile( + data: 'git-hooks/prepare-commit-msg', + name: 'prepare-commit-msg', + path: '.githooks', + ); + if (Arr::get($configurationData, 'experimental.runGitHooksBeforePush', false) === true) { $filesToGenerate[] = new TemplateFile( data: 'git-hooks/pre-push', diff --git a/templates/justfile.twig b/templates/justfile.twig index 1968eb3..feb7470 100644 --- a/templates/justfile.twig +++ b/templates/justfile.twig @@ -71,7 +71,6 @@ artisan *args: {{ "just _run artisan {{ args }}" | raw }} {% endif %} -{% if experimental.runGitHooksBeforePush %} # Enable or disable Git hooks git-hooks command: #!/usr/bin/env bash @@ -91,6 +90,7 @@ git-hooks command: ;; esac +{% if experimental.runGitHooksBeforePush %} test-commit: {% if "phpcs" in php|keys -%} just _run php phpcs