feat: Improve pre-commit hook installation robustness
This commit is contained in:
parent
ec7d3b89cd
commit
813924460d
1 changed files with 4 additions and 1 deletions
|
|
@ -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"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue