File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change @@ -395,17 +395,12 @@ func PrepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
395395 var headBranchSha string
396396 // HeadRepo may be missing
397397 if pull .HeadRepo != nil {
398- var headGitRepo * git.Repository
399- if ctx .Repo != nil && ctx .Repo .Repository != nil && pull .HeadRepoID == ctx .Repo .Repository .ID && ctx .Repo .GitRepo != nil {
400- headGitRepo = ctx .Repo .GitRepo
401- } else {
402- headGitRepo , err = gitrepo .OpenRepository (ctx , pull .HeadRepo )
403- if err != nil {
404- ctx .ServerError ("OpenRepository" , err )
405- return nil
406- }
407- defer headGitRepo .Close ()
398+ headGitRepo , closer , err := gitrepo .RepositoryFromContextOrOpen (ctx , pull .HeadRepo )
399+ if err != nil {
400+ ctx .ServerError ("RepositoryFromContextOrOpen" , err )
401+ return nil
408402 }
403+ defer closer .Close ()
409404
410405 if pull .Flow == issues_model .PullRequestFlowGithub {
411406 headBranchExist = headGitRepo .IsBranchExist (pull .HeadBranch )
You can’t perform that action at this time.
0 commit comments