Skip to content

Commit

Permalink
Merge pull request #12437 from keymanapp/chore/common/hooks
Browse files Browse the repository at this point in the history
chore(common): detect ssh remotes in git hooks
  • Loading branch information
ermshiperete authored Sep 19, 2024
2 parents 7263fcf + 44116b7 commit 90078b4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions resources/git-hooks/commit-msg
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fi

GIT_ORIGIN="$(git remote get-url origin)"

if [[ ! "$GIT_ORIGIN" =~ github\.com/keymanapp ]]; then
if [[ ! "$GIT_ORIGIN" =~ github\.com(/|:)keymanapp ]]; then
# Not a Keyman repository. We have no opinion.
# echo "DEBUG: Not a Keyman repository. We don't care"
exit 0
Expand Down Expand Up @@ -107,14 +107,18 @@ function print_error() {
echo -e "----------------------------------------------------------${t_end}"
echo -e "Valid types: ${t_grn}${types[@]}${t_end}"
echo -e "Valid scopes: ${t_grn}${scopes[@]}${t_end}"
echo -e "Max length (first line): ${t_grn}$max_length${t_end}"
echo -e ""
echo -e "Min length (first line): ${t_grn}$min_length${t_end}"
echo -e "Max length (first line): ${t_grn}$max_length${t_end}"
echo -e ""
echo -e "If possible, append git trailers:"
echo -e " * ${t_grn}Fixes: #1234${t_end}"
echo -e " * ${t_grn}Fixes: KEYMAN-MODULE-XYZ${t_end}"
echo -e " * ${t_grn}Cherry-pick-of: #2468${t_end}"
echo -e " * ${t_grn}Co-authored-by: Firstname Lastname <[email protected]>${t_end}"
echo -e ""
echo -e "${t_cyn}Example:${t_end} fix(windows): Re-attach the widget plug which had fallen out"
echo -e ""
echo -e "${t_cyn}Reference${t_end}: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes"
echo -e ""
echo -e "Tips: "
Expand All @@ -136,4 +140,4 @@ if [[ ! $msg =~ $regexp ]]; then
print_error
fi
exit 1
fi
fi
2 changes: 1 addition & 1 deletion resources/git-hooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

GIT_ORIGIN="$(git remote get-url origin)"

if [[ ! "$GIT_ORIGIN" =~ github\.com/keymanapp ]]; then
if [[ ! "$GIT_ORIGIN" =~ github\.com(/|:)keymanapp ]]; then
# Not a Keyman repository. We have no opinion.
echo "DEBUG: Not a Keyman repository. We don't care"
exit 0
Expand Down

0 comments on commit 90078b4

Please sign in to comment.