fix: empty commit
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing

This commit is contained in:
zzjc1234 2024-09-19 10:41:59 +08:00
parent d299849c78
commit e8506eeb51

View File

@ -88,16 +88,26 @@ func commitMsgToConf() (conf Conf, err error) {
if err != nil {
return
}
ref, err := r.Head()
if err != nil {
return
}
commit, err := r.CommitObject(ref.Hash())
if err != nil {
return
}
file := "conf.toml"
msg := commit.Message
slog.Debug("commit msg to conf", "msg", msg)
if msg == "" {
conf, err = parseConfFile(file)
return
}
line := strings.Split(msg, "\n")[0]
words := strings.Fields(line)
@ -109,8 +119,6 @@ func commitMsgToConf() (conf Conf, err error) {
head = head[:len(head)-1]
}
file := "conf.toml"
switch head {
case "feat", "fix", "refactor", "perf", "test", "build", "revert":
if len(words) < 2 {