Skip to content

Instantly share code, notes, and snippets.

@amatellanes
Created March 24, 2019 16:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amatellanes/95ffa595e17cd3f918beb190f7d5b5b9 to your computer and use it in GitHub Desktop.
Save amatellanes/95ffa595e17cd3f918beb190f7d5b5b9 to your computer and use it in GitHub Desktop.
Check that a commit comment mentions the current branch name (potentially tracking issue ID)
#!/usr/bin/env bash
HG_COMMIT_MESSAGE="$(hg tip --template {desc})"
HG_BRANCH="$(hg identify -b)"
if [[ ${HG_COMMIT_MESSAGE=} = *${HG_BRANCH}* ]]; then
exit 0
fi
exit 1
[hooks]
pretxncommit.issue_id_required = ~/.hg_check_issue_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment