docs(pr create): standard <user>:<branch> syntax

Standardize <user>:<branch> syntax wherever it is described in comments.
This commit is contained in:
Kynan Ware 2025-03-11 14:10:45 -06:00
parent 6dae35b442
commit 041f02c980
3 changed files with 4 additions and 4 deletions

View file

@ -599,7 +599,7 @@ func NewCreateContext(opts *CreateOptions) (*CreateContext, error) {
promptForHeadRepo = false
targetHeadBranch = opts.HeadBranch
// If the --head provided contains a colon, that means
// this is <owner>:<branch> syntax.
// this is <user>:<branch> syntax.
if idx := strings.IndexRune(opts.HeadBranch, ':'); idx >= 0 {
targetHeadRepoOwner = opts.HeadBranch[:idx]
targetHeadBranch = opts.HeadBranch[idx+1:]
@ -636,7 +636,7 @@ func NewCreateContext(opts *CreateOptions) (*CreateContext, error) {
return nil, err
}
// If the --head provided contains <repo_name>:<branch> syntax, we need to use
// If the --head provided contains <user>:<branch> syntax, we need to use
// the provided owner instead of the owner of the base repository.
if targetHeadRepoOwner != "" {
prRefs.HeadRepo = ghrepo.New(targetHeadRepoOwner, prRefs.HeadRepo.RepoName())

View file

@ -1547,7 +1547,7 @@ func Test_createRun(t *testing.T) {
expectedErrOut: "\nCreating pull request for monalisa:task1 into feature/feat2 in OWNER/REPO\n\n",
},
{
name: "--head contains <remote>:<branch> syntax",
name: "--head contains <user>:<branch> syntax",
httpStubs: func(reg *httpmock.Registry, t *testing.T) {
reg.Register(
httpmock.GraphQL(`mutation PullRequestCreate\b`),

View file

@ -115,7 +115,7 @@ func (s *PullRequestRefs) HasHead() bool {
// GetPRHeadLabel returns the string that the GitHub API uses to identify the PR. This is
// either just the branch name or, if the PR is originating from a fork, the fork owner
// and the branch name, like <owner>:<branch>.
// and the branch name, like <user>:<branch>.
func (s *PullRequestRefs) GetPRHeadLabel() string {
if ghrepo.IsSame(s.HeadRepo, s.BaseRepo) {
return s.BranchName