diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-06-28 23:56:41 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-06-28 23:56:41 +0800 |
commit | 1c46d68abaf08890e10386b3af674233b4dda2d3 (patch) | |
tree | ee366ead93743202b7a1d92936cbaaed76623867 /modules | |
parent | 4ce2fa520a1d9c36febd19562015107b74a4bc1d (diff) | |
download | gitea-1c46d68abaf08890e10386b3af674233b4dda2d3.tar.gz gitea-1c46d68abaf08890e10386b3af674233b4dda2d3.zip |
bug fixed for message tag
Diffstat (limited to 'modules')
-rw-r--r-- | modules/middleware/context.go | 2 | ||||
-rw-r--r-- | modules/middleware/repo.go | 7 |
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) |