0
0
mirror of https://github.com/thegeeklab/git-sv.git synced 2024-11-22 08:20:39 +00:00

feat: ability to only select a subset of the message

issue: #45
This commit is contained in:
hypervtechnics 2022-03-03 12:54:07 +01:00
parent 44895fa4a2
commit 9d69abc45a

View File

@ -202,7 +202,17 @@ func (p MessageProcessorImpl) Format(msg CommitMessage) (string, string, string)
// Parse a commit message. // Parse a commit message.
func (p MessageProcessorImpl) Parse(subject, body string) CommitMessage { func (p MessageProcessorImpl) Parse(subject, body string) CommitMessage {
commitType, scope, description, hasBreakingChange := parseSubjectMessage(subject)
filteredSubject := subject
if p.messageCfg.MessageSelector != "" {
subjectRegex := regexp.MustCompile(p.messageCfg.MessageSelector)
subjectMessageIndex := regex.SubexpIndex("message")
subjectMatch := regex.FindStringSubmatch(subject)
filteredSubject = subjectMatch[subjectMessageIndex]
}
commitType, scope, description, hasBreakingChange := parseSubjectMessage(filteredSubject)
metadata := make(map[string]string) metadata := make(map[string]string)
for key, mdCfg := range p.messageCfg.Footer { for key, mdCfg := range p.messageCfg.Footer {