Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion utils/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,11 @@ func (gm *GitManager) GenerateAggregatedFixBranchName(baseBranch string, tech []
if err != nil {
return "", err
}
return formatStringWithPlaceHolders(branchFormat, "", "", hash, baseBranch, false), nil
if branchFormat != AggregatedBranchNameTemplate {
return formatStringWithPlaceHolders(branchFormat, "", "", hash, "", false), nil // custom: no suffix
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please write comments above if necessary

} else {
return formatStringWithPlaceHolders(branchFormat, "", "", hash, baseBranch, false), nil // default: append base branch
}
}

// dryRunClone clones an existing repository from our testdata folder into the destination folder for testing purposes.
Expand Down
14 changes: 10 additions & 4 deletions utils/git_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,22 @@ func TestGitManager_GenerateAggregatedFixBranchName(t *testing.T) {
gitManager: GitManager{},
},
{
expected: "[feature]-e4e1fa318f12b3bed84b13ae5c293108-main",
expected: "[feature]-e4e1fa318f12b3bed84b13ae5c293108",
baseBranch: "main",
desc: "Custom template hash only",
desc: "Custom template hash only - no base branch suffix",
gitManager: GitManager{customTemplates: CustomTemplates{branchNameTemplate: "[feature]-${BRANCH_NAME_HASH}"}},
}, {
expected: "[feature]-697bdb58caaed95527fc709da59ca47f-master",
expected: "[feature]-697bdb58caaed95527fc709da59ca47f",
baseBranch: "master",
desc: "Custom template hash only",
desc: "Custom template hash only - no base branch suffix",
gitManager: GitManager{customTemplates: CustomTemplates{branchNameTemplate: "[feature]-${BRANCH_NAME_HASH}"}},
},
{
expected: "bugfix/FRGBT-000_e4e1fa318f12b3bed84b13ae5c293108-",
baseBranch: "main",
desc: "Custom template with IMPACTED_PACKAGE empty (aggregated) - no forced suffix",
gitManager: GitManager{customTemplates: CustomTemplates{branchNameTemplate: "bugfix/FRGBT-000_{BRANCH_NAME_HASH}-{IMPACTED_PACKAGE}"}},
},
}
for _, test := range testCases {
t.Run(test.desc, func(t *testing.T) {
Expand Down
Loading