fix(cmd/joj3): return empty conventional commit on parsing error
This commit is contained in:
parent
f17c742719
commit
b147cf00a9
|
@ -40,7 +40,7 @@ func parseConventionalCommit(commit string) (*ConventionalCommit, error) {
|
||||||
re := regexp.MustCompile(`(?s)^(\w+)(\(([^)]+)\))?!?: (.+?(\[([^\]]+)\])?)(\n\n(.+?))?(\n\n(.+))?$`)
|
re := regexp.MustCompile(`(?s)^(\w+)(\(([^)]+)\))?!?: (.+?(\[([^\]]+)\])?)(\n\n(.+?))?(\n\n(.+))?$`)
|
||||||
matches := re.FindStringSubmatch(strings.TrimSpace(commit))
|
matches := re.FindStringSubmatch(strings.TrimSpace(commit))
|
||||||
if matches == nil {
|
if matches == nil {
|
||||||
return nil, fmt.Errorf("invalid conventional commit format")
|
return &ConventionalCommit{}, fmt.Errorf("invalid conventional commit format")
|
||||||
}
|
}
|
||||||
cc := &ConventionalCommit{
|
cc := &ConventionalCommit{
|
||||||
Type: matches[1],
|
Type: matches[1],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user