pull/6493/merge
Rajat Jain 2025-03-10 23:40:37 +00:00 committed by GitHub
commit b49c9a9c67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 4 deletions

View File

@ -483,7 +483,7 @@ func ParseCompareInfo(c *context.Context) (*database.User, *database.Repository,
c.Repo.PullRequest.SameRepo = isSameRepo
// Check if base branch is valid.
if !c.Repo.GitRepo.HasBranch(baseBranch) {
if !c.Repo.GitRepo.HasBranch(baseBranch) && !c.Repo.GitRepo.HasTag(baseBranch) {
c.NotFound()
return nil, nil, nil, nil, "", ""
}
@ -533,7 +533,7 @@ func ParseCompareInfo(c *context.Context) (*database.User, *database.Repository,
}
// Check if head branch is valid.
if !headGitRepo.HasBranch(headBranch) {
if !headGitRepo.HasBranch(headBranch) && !headGitRepo.HasTag(headBranch) {
c.NotFound()
return nil, nil, nil, nil, "", ""
}
@ -579,8 +579,11 @@ func PrepareCompareDiff(
headCommitID, err := headGitRepo.BranchCommitID(headBranch)
if err != nil {
c.Error(err, "get head branch commit ID")
return false
headCommitID, err = headGitRepo.TagCommitID(headBranch)
if err != nil {
c.Error(err, "get head branch commit ID")
return false
}
}
c.Data["AfterCommitID"] = headCommitID