Skip to content

Commit cb8f88f

Browse files
committed
shortsubject: merge commits may be long
due to automated "merge of <hash> in to <hash>" Signed-off-by: Vincent Batts <[email protected]>
1 parent 90191a0 commit cb8f88f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

rules/shortsubject/shortsubject.go

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package shortsubject
22

33
import (
4+
"strings"
5+
46
"github.com/vbatts/git-validation/git"
57
"github.com/vbatts/git-validation/validate"
68
)
@@ -22,6 +24,11 @@ func init() {
2224
// ValidateShortSubject checks that the commit's subject is strictly less than
2325
// 90 characters (preferably not more than 72 chars).
2426
func ValidateShortSubject(r validate.Rule, c git.CommitEntry) (vr validate.Result) {
27+
if len(strings.Split(c["parent"], " ")) > 1 {
28+
vr.Pass = true
29+
vr.Msg = "merge commits do not require length check"
30+
return vr
31+
}
2532
if len(c["subject"]) >= 90 {
2633
vr.Pass = false
2734
vr.Msg = "commit subject exceeds 90 characters"

0 commit comments

Comments
 (0)