chore(common): detect ssh remotes in git hooks

Sometime ago we lost the ability to detect git remotes that use ssh
(git@github.com:keymanapp/keyman.git) and we only detect remotes that
use https (https://github.com/keymanapp/keyman.git). This change restores
this ability.

Also add some empty lines between the different parts of the error message.

# Keyman Conventional Commit suggestions:
#
# - Link to a Sentry issue with git trailer:
#     Fixes: _MODULE_-_ID_
# - Give credit to co-authors:
#     Co-authored-by: _Name_ <_email_>
# - Use imperative, present tense ('attach' not 'attaches', 'attached' etc)
# - Don't include a period at the end of the title
# - Always include a blank line before trailers
# - More: https://github.com/keymanapp/keyman/wiki/Pull-Request-and-Commit-workflow-notes
This commit is contained in:
Eberhard Beilharz 2024-09-17 11:38:41 +02:00
parent 86feb8c157
commit 44116b70dd
No known key found for this signature in database
GPG key ID: E9140597606020D3
2 changed files with 8 additions and 4 deletions

View file

@ -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
@ -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@keyman.com>${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: "
@ -136,4 +140,4 @@ if [[ ! $msg =~ $regexp ]]; then
print_error
fi
exit 1
fi
fi

View file

@ -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