From a360b1ebfa4d331eed56fd1a1bf3e7d94f8bc9e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eric=20Rockst=C3=A4dt?= Date: Fri, 4 Aug 2023 18:22:51 +0200 Subject: [PATCH] Consider umlauts in subject length --- internal/model/commit_message.go | 2 +- internal/model/commit_message_test.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/model/commit_message.go b/internal/model/commit_message.go index 22ed110..2d28a43 100644 --- a/internal/model/commit_message.go +++ b/internal/model/commit_message.go @@ -19,7 +19,7 @@ func CreateCommitMessageFrom(messageLines []string) *CommitMessage { } func (cm *CommitMessage) ValidateSubject() int { - currentSubjectLength := len(cm.Subject) + currentSubjectLength := len([]rune(cm.Subject)) if strings.HasPrefix(cm.Subject, "Merge ") { return 0 diff --git a/internal/model/commit_message_test.go b/internal/model/commit_message_test.go index 5b405ae..da532d7 100644 --- a/internal/model/commit_message_test.go +++ b/internal/model/commit_message_test.go @@ -66,6 +66,7 @@ func TestNewCommitMessage(t *testing.T) { {"short subject line", 0}, {"Merge pull request commits are ignored because they can easily exceed 52 characters", 0}, {"Merge branch commits are also ignored..............................................", 0}, + {"I am a commit containing an umlaut ΓΌ.................", 3}, } for _, tc := range testcases {