@@ -272,12 +272,12 @@ func checkPullInfo(ctx *context.Context) *models.Issue {
272272}
273273
274274func setMergeTarget (ctx * context.Context , pull * models.PullRequest ) {
275- if ctx .Repo .Owner .Name == pull .HeadUserName {
275+ if ctx .Repo .Owner .Name == pull .MustHeadUserName () {
276276 ctx .Data ["HeadTarget" ] = pull .HeadBranch
277277 } else if pull .HeadRepo == nil {
278- ctx .Data ["HeadTarget" ] = pull .HeadUserName + ":" + pull .HeadBranch
278+ ctx .Data ["HeadTarget" ] = pull .MustHeadUserName () + ":" + pull .HeadBranch
279279 } else {
280- ctx .Data ["HeadTarget" ] = pull .HeadUserName + "/" + pull .HeadRepo .Name + ":" + pull .HeadBranch
280+ ctx .Data ["HeadTarget" ] = pull .MustHeadUserName () + "/" + pull .HeadRepo .Name + ":" + pull .HeadBranch
281281 }
282282 ctx .Data ["BaseTarget" ] = pull .BaseBranch
283283}
@@ -440,7 +440,7 @@ func ViewPullCommits(ctx *context.Context) {
440440 ctx .NotFound ("ViewPullCommits" , nil )
441441 return
442442 }
443- ctx .Data ["Username" ] = pull .HeadUserName
443+ ctx .Data ["Username" ] = pull .MustHeadUserName ()
444444 ctx .Data ["Reponame" ] = pull .HeadRepo .Name
445445 commits = prInfo .Commits
446446 }
@@ -512,7 +512,7 @@ func ViewPullFiles(ctx *context.Context) {
512512 return
513513 }
514514
515- headRepoPath := models . RepoPath ( pull .HeadUserName , pull . HeadRepo .Name )
515+ headRepoPath := pull .HeadRepo .RepoPath ( )
516516
517517 headGitRepo , err := git .OpenRepository (headRepoPath )
518518 if err != nil {
@@ -531,8 +531,8 @@ func ViewPullFiles(ctx *context.Context) {
531531 endCommitID = headCommitID
532532 gitRepo = headGitRepo
533533
534- headTarget = path .Join (pull .HeadUserName , pull .HeadRepo .Name )
535- ctx .Data ["Username" ] = pull .HeadUserName
534+ headTarget = path .Join (pull .MustHeadUserName () , pull .HeadRepo .Name )
535+ ctx .Data ["Username" ] = pull .MustHeadUserName ()
536536 ctx .Data ["Reponame" ] = pull .HeadRepo .Name
537537 }
538538
@@ -754,15 +754,14 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
754754 Content : form .Content ,
755755 }
756756 pullRequest := & models.PullRequest {
757- HeadRepoID : headRepo .ID ,
758- BaseRepoID : repo .ID ,
759- HeadUserName : headUser .Name ,
760- HeadBranch : headBranch ,
761- BaseBranch : baseBranch ,
762- HeadRepo : headRepo ,
763- BaseRepo : repo ,
764- MergeBase : prInfo .MergeBase ,
765- Type : models .PullRequestGitea ,
757+ HeadRepoID : headRepo .ID ,
758+ BaseRepoID : repo .ID ,
759+ HeadBranch : headBranch ,
760+ BaseBranch : baseBranch ,
761+ HeadRepo : headRepo ,
762+ BaseRepo : repo ,
763+ MergeBase : prInfo .MergeBase ,
764+ Type : models .PullRequestGitea ,
766765 }
767766 // FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
768767 // instead of 500.
0 commit comments