mirror of
https://github.com/thegeeklab/git-sv.git
synced 2024-11-24 11:10:39 +00:00
refactor: merge breaking change key and tag
This commit is contained in:
parent
2cd32e3ed3
commit
e18b0cc08f
13
sv/git.go
13
sv/git.go
@ -13,10 +13,13 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
logSeparator = "##"
|
||||
endLine = "~~"
|
||||
breakingChangesKey = "breakingchange"
|
||||
issueIDKey = "issueid"
|
||||
logSeparator = "##"
|
||||
endLine = "~~"
|
||||
|
||||
// BreakingChangesKey key to breaking change metadata
|
||||
BreakingChangesKey = "breakingchange"
|
||||
// IssueIDKey key to issue id metadata
|
||||
IssueIDKey = "issueid"
|
||||
)
|
||||
|
||||
// Git commands
|
||||
@ -52,7 +55,7 @@ type GitImpl struct {
|
||||
// NewGit constructor
|
||||
func NewGit(breakinChangePrefixes, issueIDPrefixes []string, tagPattern string) *GitImpl {
|
||||
return &GitImpl{
|
||||
messageMetadata: map[string][]string{breakingChangesKey: breakinChangePrefixes, issueIDKey: issueIDPrefixes},
|
||||
messageMetadata: map[string][]string{BreakingChangesKey: breakinChangePrefixes, IssueIDKey: issueIDPrefixes},
|
||||
tagPattern: tagPattern,
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ func (p ReleaseNoteProcessorImpl) Create(version semver.Version, date time.Time,
|
||||
section.Items = append(section.Items, commit)
|
||||
sections[commit.Type] = section
|
||||
}
|
||||
if value, exists := commit.Metadata[BreakingChangeTag]; exists {
|
||||
if value, exists := commit.Metadata[BreakingChangesKey]; exists {
|
||||
breakingChanges = append(breakingChanges, value)
|
||||
}
|
||||
}
|
||||
|
@ -24,9 +24,6 @@ func ToVersion(value string) (semver.Version, error) {
|
||||
return *v, nil
|
||||
}
|
||||
|
||||
// BreakingChangeTag breaking change tag from commit metadata
|
||||
const BreakingChangeTag string = "breakingchange"
|
||||
|
||||
// SemVerCommitsProcessor interface
|
||||
type SemVerCommitsProcessor interface {
|
||||
NextVersion(version semver.Version, commits []GitCommitLog) semver.Version
|
||||
@ -72,7 +69,7 @@ func (p SemVerCommitsProcessorImpl) NextVersion(version semver.Version, commits
|
||||
}
|
||||
|
||||
func (p SemVerCommitsProcessorImpl) versionTypeToUpdate(commit GitCommitLog) versionType {
|
||||
if _, exists := commit.Metadata[BreakingChangeTag]; exists {
|
||||
if _, exists := commit.Metadata[BreakingChangesKey]; exists {
|
||||
return major
|
||||
}
|
||||
if _, exists := p.MajorVersionTypes[commit.Type]; exists {
|
||||
|
Loading…
Reference in New Issue
Block a user