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