Skip to content

Commit

Permalink
#912: catch error for unrecognized branch names that broke the post-c…
Browse files Browse the repository at this point in the history
…heckout hook
  • Loading branch information
JoernBerkefeld committed May 17, 2023
1 parent 45d29e8 commit 93e4724
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@

# ### git commit message template ###
git config commit.template .git/templatemessage
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '((feature|bug|bugfix|fix|hotfix|task|chore)\/)\K\d{1,7}'`
echo "[POST_CHECKOUT] Setting template commit to $TICKETID"
echo "#$TICKETID: " > ".git/templatemessage"
TICKETID=`git rev-parse --abbrev-ref HEAD | LC_ALL=en_US.utf8 grep -oP '((feature|bug|bugfix|fix|hotfix|task|chore)\/)\K\d{1,7}' || true`
if [ -z "$TICKETID" ]
then
TICKETID="0"
fi
TEMPLATE="#$TICKETID: "
echo "[POST_CHECKOUT] Setting template commit to '$TEMPLATE'"
echo $TEMPLATE > ".git/templatemessage"


# ### run npm install ###
Expand Down

0 comments on commit 93e4724

Please sign in to comment.