Skip to content

Commit

Permalink
Updated pre commit to use an alternative method of finding the branch…
Browse files Browse the repository at this point in the history
… name (#579)
  • Loading branch information
keegansmith21 authored Sep 2, 2022
1 parent a3c8671 commit bad47e5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion bin/prefix_commit_jira.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
REGEX_ISSUE_ID="^[A-Z]{1,10}-[0-9]{1,5}"

# Find current branch name
BRANCH_NAME=$(git symbolic-ref --short HEAD)
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)

if [[ -z "$BRANCH_NAME" ]]; then
echo "No branch name... "; exit 1
fi

if [[ $BRANCH_NAME = "HEAD" ]]; then
echo "Rebase detected. Skipping pre-commit hook"; exit 0
fi

# Extract issue id from branch name
ISSUE_ID=$(echo "$BRANCH_NAME" | grep -o -E "$REGEX_ISSUE_ID")

Expand Down

0 comments on commit bad47e5

Please sign in to comment.