@@ -272,12 +272,12 @@ func checkPullInfo(ctx *context.Context) *models.Issue {
272
272
}
273
273
274
274
func setMergeTarget (ctx * context.Context , pull * models.PullRequest ) {
275
- if ctx .Repo .Owner .Name == pull .HeadUserName {
275
+ if ctx .Repo .Owner .Name == pull .MustHeadUserName () {
276
276
ctx .Data ["HeadTarget" ] = pull .HeadBranch
277
277
} else if pull .HeadRepo == nil {
278
- ctx .Data ["HeadTarget" ] = pull .HeadUserName + ":" + pull .HeadBranch
278
+ ctx .Data ["HeadTarget" ] = pull .MustHeadUserName () + ":" + pull .HeadBranch
279
279
} else {
280
- ctx .Data ["HeadTarget" ] = pull .HeadUserName + "/" + pull .HeadRepo .Name + ":" + pull .HeadBranch
280
+ ctx .Data ["HeadTarget" ] = pull .MustHeadUserName () + "/" + pull .HeadRepo .Name + ":" + pull .HeadBranch
281
281
}
282
282
ctx .Data ["BaseTarget" ] = pull .BaseBranch
283
283
}
@@ -440,7 +440,7 @@ func ViewPullCommits(ctx *context.Context) {
440
440
ctx .NotFound ("ViewPullCommits" , nil )
441
441
return
442
442
}
443
- ctx .Data ["Username" ] = pull .HeadUserName
443
+ ctx .Data ["Username" ] = pull .MustHeadUserName ()
444
444
ctx .Data ["Reponame" ] = pull .HeadRepo .Name
445
445
commits = prInfo .Commits
446
446
}
@@ -512,7 +512,7 @@ func ViewPullFiles(ctx *context.Context) {
512
512
return
513
513
}
514
514
515
- headRepoPath := models . RepoPath ( pull .HeadUserName , pull . HeadRepo .Name )
515
+ headRepoPath := pull .HeadRepo .RepoPath ( )
516
516
517
517
headGitRepo , err := git .OpenRepository (headRepoPath )
518
518
if err != nil {
@@ -531,8 +531,8 @@ func ViewPullFiles(ctx *context.Context) {
531
531
endCommitID = headCommitID
532
532
gitRepo = headGitRepo
533
533
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 ()
536
536
ctx .Data ["Reponame" ] = pull .HeadRepo .Name
537
537
}
538
538
@@ -754,15 +754,14 @@ func CompareAndPullRequestPost(ctx *context.Context, form auth.CreateIssueForm)
754
754
Content : form .Content ,
755
755
}
756
756
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 ,
766
765
}
767
766
// FIXME: check error in the case two people send pull request at almost same time, give nice error prompt
768
767
// instead of 500.
0 commit comments