Skip to content

Commit

Permalink
Merge pull request #409 from igdianov/main
Browse files Browse the repository at this point in the history
fix(environments): add support for base branch option for new pull requests
  • Loading branch information
jenkins-x-bot authored Oct 3, 2022
2 parents 70acb55 + 4656708 commit c67fe78
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/environments/gitops.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ func (o *EnvironmentPullRequestOptions) Create(gitURL, prDir string, pullRequest
dir, err = gitclient.SparseCloneToDir(o.Gitter, cloneGitURL, "", true, o.SparseCheckoutPatterns...)
} else {
dir, err = gitclient.CloneToDir(o.Gitter, cloneGitURL, "")
if o.BaseBranchName != "" {
log.Logger().Infof("checking out remote base branch %s from %s", o.BaseBranchName, gitURL)
err = gitclient.CheckoutRemoteBranch(o.Gitter, dir, o.BaseBranchName)
if err != nil {
return nil, errors.Wrapf(err, "failed to checkout remote branch %s from %s", o.BaseBranchName, gitURL)
}
}
}
if err != nil {
return nil, errors.Wrapf(err, "failed to clone git URL %s", cloneGitURLSafe)
Expand Down

0 comments on commit c67fe78

Please sign in to comment.