summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/middleware/context.go2
-rw-r--r--modules/middleware/repo.go7
2 files changed, 6 insertions, 3 deletions
diff --git a/modules/middleware/context.go b/modules/middleware/context.go
index 45f0140a28..8e7ac4209e 100644
--- a/modules/middleware/context.go
+++ b/modules/middleware/context.go
@@ -56,8 +56,10 @@ type Context struct {
Repository *models.Repository
Owner *models.User
Commit *git.Commit
+ Tag *git.Tag
GitRepo *git.Repository
BranchName string
+ TagName string
CommitId string
RepoLink string
CloneLink struct {
diff --git a/modules/middleware/repo.go b/modules/middleware/repo.go
index 0c64027552..7ba211c71f 100644
--- a/modules/middleware/repo.go
+++ b/modules/middleware/repo.go
@@ -185,16 +185,16 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
ctx.Repo.CommitId = ctx.Repo.Commit.Id.String()
} else if gitRepo.IsTagExist(refName) {
- ctx.Repo.IsBranch = true
+ ctx.Repo.IsTag = true
ctx.Repo.BranchName = refName
- ctx.Repo.Commit, err = gitRepo.GetCommitOfTag(refName)
+ ctx.Repo.Tag, err = gitRepo.GetTag(refName)
if err != nil {
ctx.Handle(404, "RepoAssignment invalid tag", nil)
return
}
+ ctx.Repo.Commit, _ = ctx.Repo.Tag.Commit()
ctx.Repo.CommitId = ctx.Repo.Commit.Id.String()
-
} else if len(refName) == 40 {
ctx.Repo.IsCommit = true
ctx.Repo.CommitId = refName
@@ -244,6 +244,7 @@ func RepoAssignment(redirect bool, args ...bool) martini.Handler {
}
ctx.Data["BranchName"] = ctx.Repo.BranchName
+ ctx.Data["TagName"] = ctx.Repo.TagName
brs, err := ctx.Repo.GitRepo.GetBranches()
if err != nil {
log.Error("RepoAssignment(GetBranches): %v", err)