feat: Improve pre-commit hook installation robustness

This commit is contained in:
Matteo Cherubini 2026-06-12 12:16:17 +02:00
parent ec7d3b89cd
commit 813924460d

View file

@ -64,8 +64,11 @@ scaffold_genome() {
install_precommit_hook() { install_precommit_hook() {
local repo_path="$1" local repo_path="$1"
local hook_path="${repo_path}/.git/hooks/pre-commit" local hooks_dir
hooks_dir="$(git -C "$repo_path" rev-parse --git-path hooks)"
local hook_path="${hooks_dir}/pre-commit"
mkdir -p "$hooks_dir"
cp "${TEMPLATES_DIR}/pre-commit.sh" "$hook_path" cp "${TEMPLATES_DIR}/pre-commit.sh" "$hook_path"
chmod +x "$hook_path" chmod +x "$hook_path"
success "Pre-commit security hook installed at: $hook_path" success "Pre-commit security hook installed at: $hook_path"