bug fixed for message tag

This commit is contained in:
Lunny Xiao 2014-06-28 23:56:41 +08:00
parent 4ce2fa520a
commit 1c46d68aba
6 changed files with 105 additions and 35 deletions

View file

@ -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 {

View file

@ -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)