Skip to content

Commit

Permalink
Use specified default branch if it exists while generating git commits
Browse files Browse the repository at this point in the history
  • Loading branch information
abheekda1 committed Mar 20, 2022
1 parent 2c4c5d1 commit e5f19d0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/repository/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,13 @@ func generateRepoCommit(ctx context.Context, repo, templateRepo, generateRepo *r
return fmt.Errorf("git remote add: %v", err)
}

return initRepoCommit(ctx, tmpDir, repo, repo.Owner, templateRepo.DefaultBranch)
// set default branch based on whether it's specified in the newly generated repo or not
defaultBranch := repo.DefaultBranch
if strings.TrimSpace(defaultBranch) == "" {
defaultBranch = templateRepo.DefaultBranch
}

return initRepoCommit(ctx, tmpDir, repo, repo.Owner, defaultBranch)
}

func generateGitContent(ctx context.Context, repo, templateRepo, generateRepo *repo_model.Repository) (err error) {
Expand Down

0 comments on commit e5f19d0

Please sign in to comment.