@@ -196,7 +196,7 @@ func GetPullDiffStats(ctx *context.Context) {
196196 }
197197
198198 // do not report 500 server error to end users if error occurs, otherwise a PR missing ref won't be able to view.
199- headCommitID , err := ctx .Repo .GitRepo .GetRefCommitID (pull .GetGitRefName ())
199+ headCommitID , err := ctx .Repo .GitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
200200 if err != nil {
201201 log .Error ("Failed to GetRefCommitID: %v, repo: %v" , err , ctx .Repo .Repository .FullName ())
202202 return
@@ -218,13 +218,13 @@ func GetMergedBaseCommitID(ctx *context.Context, issue *issues_model.Issue) stri
218218 if pull .MergeBase == "" {
219219 var commitSHA , parentCommit string
220220 // If there is a head or a patch file, and it is readable, grab info
221- commitSHA , err := ctx .Repo .GitRepo .GetRefCommitID (pull .GetGitRefName ())
221+ commitSHA , err := ctx .Repo .GitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
222222 if err != nil {
223223 // Head File does not exist, try the patch
224224 commitSHA , err = ctx .Repo .GitRepo .ReadPatchCommit (pull .Index )
225225 if err == nil {
226226 // Recreate pull head in files for next time
227- if err := ctx .Repo .GitRepo .SetReference (pull .GetGitRefName (), commitSHA ); err != nil {
227+ if err := ctx .Repo .GitRepo .SetReference (pull .GetGitHeadRefName (), commitSHA ); err != nil {
228228 log .Error ("Could not write head file" , err )
229229 }
230230 } else {
@@ -274,7 +274,7 @@ func prepareMergedViewPullInfo(ctx *context.Context, issue *issues_model.Issue)
274274 baseCommit := GetMergedBaseCommitID (ctx , issue )
275275
276276 compareInfo , err := ctx .Repo .GitRepo .GetCompareInfo (ctx .Repo .Repository .RepoPath (),
277- baseCommit , pull .GetGitRefName (), false , false )
277+ baseCommit , pull .GetGitHeadRefName (), false , false )
278278 if err != nil {
279279 if strings .Contains (err .Error (), "fatal: Not a valid object name" ) || strings .Contains (err .Error (), "unknown revision or path not in the working tree" ) {
280280 ctx .Data ["IsPullRequestBroken" ] = true
@@ -354,9 +354,9 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
354354 ctx .Data ["BaseTarget" ] = pull .BaseBranch
355355 ctx .Data ["HeadTarget" ] = pull .HeadBranch
356356
357- sha , err := baseGitRepo .GetRefCommitID (pull .GetGitRefName ())
357+ sha , err := baseGitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
358358 if err != nil {
359- ctx .ServerError (fmt .Sprintf ("GetRefCommitID(%s)" , pull .GetGitRefName ()), err )
359+ ctx .ServerError (fmt .Sprintf ("GetRefCommitID(%s)" , pull .GetGitHeadRefName ()), err )
360360 return nil
361361 }
362362 commitStatuses , err := git_model .GetLatestCommitStatus (ctx , repo .ID , sha , db .ListOptionsAll )
@@ -374,7 +374,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
374374 }
375375
376376 compareInfo , err := baseGitRepo .GetCompareInfo (pull .BaseRepo .RepoPath (),
377- pull .MergeBase , pull .GetGitRefName (), false , false )
377+ pull .MergeBase , pull .GetGitHeadRefName (), false , false )
378378 if err != nil {
379379 if strings .Contains (err .Error (), "fatal: Not a valid object name" ) {
380380 ctx .Data ["IsPullRequestBroken" ] = true
@@ -407,12 +407,12 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
407407 if pull .Flow == issues_model .PullRequestFlowGithub {
408408 headBranchExist = gitrepo .IsBranchExist (ctx , pull .HeadRepo , pull .HeadBranch )
409409 } else {
410- headBranchExist = gitrepo .IsReferenceExist (ctx , pull .BaseRepo , pull .GetGitRefName ())
410+ headBranchExist = gitrepo .IsReferenceExist (ctx , pull .BaseRepo , pull .GetGitHeadRefName ())
411411 }
412412
413413 if headBranchExist {
414414 if pull .Flow != issues_model .PullRequestFlowGithub {
415- headBranchSha , err = baseGitRepo .GetRefCommitID (pull .GetGitRefName ())
415+ headBranchSha , err = baseGitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
416416 } else {
417417 headBranchSha , err = headGitRepo .GetBranchCommitID (pull .HeadBranch )
418418 }
@@ -435,7 +435,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
435435 ctx .Data ["GetCommitMessages" ] = ""
436436 }
437437
438- sha , err := baseGitRepo .GetRefCommitID (pull .GetGitRefName ())
438+ sha , err := baseGitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
439439 if err != nil {
440440 if git .IsErrNotExist (err ) {
441441 ctx .Data ["IsPullRequestBroken" ] = true
@@ -451,7 +451,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
451451 ctx .Data ["NumFiles" ] = 0
452452 return nil
453453 }
454- ctx .ServerError (fmt .Sprintf ("GetRefCommitID(%s)" , pull .GetGitRefName ()), err )
454+ ctx .ServerError (fmt .Sprintf ("GetRefCommitID(%s)" , pull .GetGitHeadRefName ()), err )
455455 return nil
456456 }
457457
@@ -522,7 +522,7 @@ func prepareViewPullInfo(ctx *context.Context, issue *issues_model.Issue) *git.C
522522 }
523523
524524 compareInfo , err := baseGitRepo .GetCompareInfo (pull .BaseRepo .RepoPath (),
525- git .BranchPrefix + pull .BaseBranch , pull .GetGitRefName (), false , false )
525+ git .BranchPrefix + pull .BaseBranch , pull .GetGitHeadRefName (), false , false )
526526 if err != nil {
527527 if strings .Contains (err .Error (), "fatal: Not a valid object name" ) {
528528 ctx .Data ["IsPullRequestBroken" ] = true
@@ -698,7 +698,7 @@ func viewPullFiles(ctx *context.Context, specifiedStartCommit, specifiedEndCommi
698698 return
699699 }
700700
701- headCommitID , err := gitRepo .GetRefCommitID (pull .GetGitRefName ())
701+ headCommitID , err := gitRepo .GetRefCommitID (pull .GetGitHeadRefName ())
702702 if err != nil {
703703 ctx .ServerError ("GetRefCommitID" , err )
704704 return
@@ -1509,7 +1509,7 @@ func CleanUpPullRequest(ctx *context.Context) {
15091509 }()
15101510
15111511 // Check if branch has no new commits
1512- headCommitID , err := gitBaseRepo .GetRefCommitID (pr .GetGitRefName ())
1512+ headCommitID , err := gitBaseRepo .GetRefCommitID (pr .GetGitHeadRefName ())
15131513 if err != nil {
15141514 log .Error ("GetRefCommitID: %v" , err )
15151515 ctx .Flash .Error (ctx .Tr ("repo.branch.deletion_failed" , fullBranchName ))
0 commit comments