Skip to content

Commit 41a9c6e

Browse files
authored
Merge pull request #71 from rootstrap/fix/husky_pre_commit_hook_not_working_for_new_projects
fix(husky): pre-commit hook not working for new projects
2 parents 10f4f87 + 95ffee9 commit 41a9c6e

File tree

2 files changed

+1
-6
lines changed

2 files changed

+1
-6
lines changed

.husky/commit-msg

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
3-
41
pnpm commitlint --edit $1

.husky/pre-commit

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
#!/bin/sh
2-
. "$(dirname "$0")/_/husky.sh"
31
. "$(dirname "$0")/common.sh"
42

53

64
echo "===\n>> Checking branch name..."
75

86
# Check if branch protection is enabled
97
if [[ -z $SKIP_BRANCH_PROTECTION ]]; then
10-
BRANCH=$(git rev-parse --abbrev-ref HEAD)
8+
BRANCH=$(git branch --show-current)
119
PROTECTED_BRANCHES="^(main|master)"
1210

1311
if [[ $BRANCH =~ $PROTECTED_BRANCHES ]]; then

0 commit comments

Comments
 (0)