Skip to content

Commit 54798fd

Browse files
author
Tobias Meinhardt
committed
Allow feature branch creation from feature branch
1 parent f1ba3d9 commit 54798fd

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

feature.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ func FeatureFromBranch(branchName string) (b AuthoredBranch, err error) {
4444
// CreationIsAllowedFrom returns wheter branch is allowed to be created
4545
// from given this source branch
4646
func (f feature) CreationIsAllowedFrom(sourceBranch Branch) bool {
47-
return strings.Contains(sourceBranch.ShortBranchName(), "develop")
47+
matched, err := regexp.Match(FEATURE_BRANCH_PATTERN, []byte(sourceBranch.BranchName()))
48+
return strings.Contains(sourceBranch.ShortBranchName(), "develop") || (matched && err == nil)
4849
}
4950

5051
// CanBeClosed checks if the branch name is a valid

feature_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ var _ = Describe("Feature", func() {
4545
})
4646
})
4747

48-
It("is only allowed to create from develop branch", func() {
48+
It("is allowed to create from develop or feature branch", func() {
4949
ForEachTestSet(branches, func(branch interface{}) {
5050
f := branch.(AuthoredBranch)
5151
for _, testBranch := range MockBranchCollection() {
5252
testBranchName := testBranch.ShortBranchName()
53-
if testBranchName == DEVELOP_BRANCH {
53+
if testBranchName == DEVELOP_BRANCH || testBranchName == FEAUTURE_BRANCH {
5454
Expect(f.CreationIsAllowedFrom(testBranch)).To(BeTrue())
5555
} else {
5656
Expect(f.CreationIsAllowedFrom(testBranch)).To(BeFalse())

0 commit comments

Comments
 (0)