Skip to content

Commit 2c4c5d1

Browse files
committed
Only set default branch to the one from the template if not specified
1 parent 3fbbbe0 commit 2c4c5d1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

modules/repository/generate.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,11 @@ func generateGitContent(ctx context.Context, repo, templateRepo, generateRepo *r
208208
return fmt.Errorf("getRepositoryByID: %v", err)
209209
}
210210

211-
repo.DefaultBranch = templateRepo.DefaultBranch
211+
// if there was no default branch supplied when generating the repo, use the default one from the template
212+
if strings.TrimSpace(repo.DefaultBranch) == "" {
213+
repo.DefaultBranch = templateRepo.DefaultBranch
214+
}
215+
212216
gitRepo, err := git.OpenRepositoryCtx(ctx, repo.RepoPath())
213217
if err != nil {
214218
return fmt.Errorf("openRepository: %v", err)

0 commit comments

Comments
 (0)