From 190b83e05eb1ade979c0e17314ab892832d62e5b Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 13 Apr 2014 22:20:28 -0400 Subject: [PATCH] push tag support --- models/action.go | 13 ++++++++----- models/update.go | 2 +- templates/release/list.tmpl | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/models/action.go b/models/action.go index 3edb884e27..a9a41a9f4d 100644 --- a/models/action.go +++ b/models/action.go @@ -6,9 +6,10 @@ package models import ( "encoding/json" + "strings" "time" - // "github.com/gogits/git" + "github.com/gogits/git" "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" @@ -74,10 +75,12 @@ func CommitRepoAction(userId int64, userName, actEmail string, opType := OP_COMMIT_REPO // Check it's tag push or branch. - // if git.IsTagExist(RepoPath(userName, repoName), refName) { - // opType = OP_PUSH_TAG - // commit = &base.PushCommits{} - // } + if strings.HasPrefix(refName, "refs/tags/") { + opType = OP_PUSH_TAG + commit = &base.PushCommits{} + } + + refName = git.RefEndName(refName) bs, err := json.Marshal(commit) if err != nil { diff --git a/models/update.go b/models/update.go index ba0e979348..2f59547b72 100644 --- a/models/update.go +++ b/models/update.go @@ -78,7 +78,7 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId //commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()}) if err = CommitRepoAction(userId, userName, actEmail, - repos.Id, repoName, git.RefEndName(refName), &base.PushCommits{l.Len(), commits}); err != nil { + repos.Id, repoName, refName, &base.PushCommits{l.Len(), commits}); err != nil { qlog.Fatalf("runUpdate.models.CommitRepoAction: %v", err) } } diff --git a/templates/release/list.tmpl b/templates/release/list.tmpl index d7c4674e84..9541265c94 100644 --- a/templates/release/list.tmpl +++ b/templates/release/list.tmpl @@ -5,8 +5,8 @@

- Release / - Tags + Releases