summaryrefslogtreecommitdiffstats
path: root/routers/repo/compare.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/repo/compare.go')
-rw-r--r--routers/repo/compare.go15
1 files changed, 14 insertions, 1 deletions
diff --git a/routers/repo/compare.go b/routers/repo/compare.go
index 858e4e548e..25aff0eeba 100644
--- a/routers/repo/compare.go
+++ b/routers/repo/compare.go
@@ -381,7 +381,20 @@ func ParseCompareInfo(ctx *context.Context) (*models.User, *models.Repository, *
return nil, nil, nil, nil, "", ""
}
- compareInfo, err := headGitRepo.GetCompareInfo(baseRepo.RepoPath(), baseBranch, headBranch)
+ baseBranchRef := baseBranch
+ if baseIsBranch {
+ baseBranchRef = git.BranchPrefix + baseBranch
+ } else if baseIsTag {
+ baseBranchRef = git.TagPrefix + baseBranch
+ }
+ headBranchRef := headBranch
+ if headIsBranch {
+ headBranchRef = git.BranchPrefix + headBranch
+ } else if headIsTag {
+ headBranchRef = git.TagPrefix + headBranch
+ }
+
+ compareInfo, err := headGitRepo.GetCompareInfo(baseRepo.RepoPath(), baseBranchRef, headBranchRef)
if err != nil {
ctx.ServerError("GetCompareInfo", err)
return nil, nil, nil, nil, "", ""