diff options
author | Meaglith Ma <genedna@gmail.com> | 2014-04-23 12:29:53 +0800 |
---|---|---|
committer | Meaglith Ma <genedna@gmail.com> | 2014-04-23 12:29:53 +0800 |
commit | ee7bfe2ebe3a453beff5e8d4c1436061d321acfe (patch) | |
tree | 02575fe703fdcfaa2bd6450b852734d9305c9ce6 /models/action.go | |
parent | b270b34c98b10b0e4807048890e883b6b06a6461 (diff) | |
parent | f0cdf30134e62be6bf5924735a6145769e495cfc (diff) |
Add memcached and redis Docker supported
Diffstat (limited to 'models/action.go')
-rw-r--r-- | models/action.go | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/models/action.go b/models/action.go index a642a82c..a9a41a9f 100644 --- a/models/action.go +++ b/models/action.go @@ -6,8 +6,11 @@ package models import ( "encoding/json" + "strings" "time" + "github.com/gogits/git" + "github.com/gogits/gogs/modules/base" "github.com/gogits/gogs/modules/log" ) @@ -22,6 +25,7 @@ const ( OP_CREATE_ISSUE OP_PULL_REQUEST OP_TRANSFER_REPO + OP_PUSH_TAG ) // Action represents user operation type and other information to repository., @@ -67,7 +71,16 @@ func (a Action) GetContent() string { // CommitRepoAction adds new action for committing repository. func CommitRepoAction(userId int64, userName, actEmail string, repoId int64, repoName string, refName string, commit *base.PushCommits) error { - log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName) + // log.Trace("action.CommitRepoAction(start): %d/%s", userId, repoName) + + opType := OP_COMMIT_REPO + // Check it's tag push or branch. + 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 { @@ -76,7 +89,7 @@ func CommitRepoAction(userId int64, userName, actEmail string, } if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: actEmail, - OpType: OP_COMMIT_REPO, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil { + OpType: opType, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil { log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName) return err } |