Skip to content

Commit

Permalink
Copy pre-commit hook to real GIT_DIR
Browse files Browse the repository at this point in the history
This is not always ".git" - for example, if this repository is a
submodule or worktree, or if $GIT_DIR is set explicitly.
  • Loading branch information
djpohly committed Dec 21, 2023
1 parent ffa4136 commit 0bd1524
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ SHELL=/bin/bash

STATIC_ANALYSIS_CHECKER := $(shell which shellcheck 2> /dev/null)
LINTER_CHECKER := $(shell which ec 2> /dev/null)
GIT_DIR = $(shell git rev-parse --git-dir 2> /dev/null)

OS:=
ifeq ($(OS),Windows_NT)
Expand Down Expand Up @@ -72,7 +73,7 @@ env/example:

pre_commit/install:
@echo "Installing pre-commit hooks"
cp $(PRE_COMMIT_SCRIPTS_FILE) ./.git/hooks/
cp $(PRE_COMMIT_SCRIPTS_FILE) $(GIT_DIR)/hooks/

pre_commit/run: test sa lint env/example

Expand Down

0 comments on commit 0bd1524

Please sign in to comment.