chore: comment of code

This commit is contained in:
zzjc1234 2024-09-12 16:10:44 +08:00 committed by 周赵嘉程521432910016
parent 9065d4f824
commit a0cd1b66c2

View File

@ -10,7 +10,11 @@ import (
"github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/object"
) )
// NonAsciiMsg checks for non-ASCII characters in the commit message. // nonAsciiMsg checks for non-ASCII characters in the commit message.
// If the message starts with "Merge pull request", it skips the non-ASCII characters check.
// Otherwise, it iterates over each character in the message and checks if it is a non-ASCII character.
// If a non-ASCII character is found, it returns an error indicating not to use non-ASCII characters in commit messages.
// Otherwise, it returns nil indicating that the commit message is valid.
// It skips the non-ASCII characters check for lines starting with specific keywords like "Co-authored-by", "Reviewed-by", and "Co-committed-by". // It skips the non-ASCII characters check for lines starting with specific keywords like "Co-authored-by", "Reviewed-by", and "Co-committed-by".
func NonAsciiMsg(root string) error { func NonAsciiMsg(root string) error {
repo, err := git.PlainOpen(root) repo, err := git.PlainOpen(root)