Skip to content

Commit d9400b0

Browse files
author
mritd
committed
fix(0.0.1): 增加对自动 merge 消息的兼容
增加在 pull 远程分支到本地时,自动产生的 "Merge branch..." 消息的兼容处理 Signed-off-by: mritd <[email protected]>
1 parent c56c452 commit d9400b0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

pkg/commit/cm.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"io/ioutil"
66
"os"
77
"regexp"
8+
"strings"
89

910
"github.com/mritd/gitflow-toolkit/pkg/consts"
1011
"github.com/mritd/gitflow-toolkit/pkg/util"
@@ -38,7 +39,9 @@ func CheckCommitMessage(args []string) {
3839
case string(consts.CHORE):
3940
case string(consts.PERF):
4041
default:
41-
checkFailed()
42+
if !strings.HasPrefix(string(b), "Merge branch") {
43+
checkFailed()
44+
}
4245
}
4346
}
4447
}

pkg/consts/consts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,4 @@ const CommitTpl = `{{ .Type }}({{ .Scope }}): {{ .Subject }}
3232
{{ .Sob }}
3333
`
3434

35-
const CommitMessagePattern = `^(?:fixup!\s*)?(\w*)(\(([\w\$\.\*/-]*)\))?\: (.*)`
35+
const CommitMessagePattern = `^(?:fixup!\s*)?(\w*)(\(([\w\$\.\*/-]*)\))?\: (.*)|^Merge\ branch(.*)`

0 commit comments

Comments
 (0)