1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-12-04 14:46:57 -05:00

bug fixed

This commit is contained in:
Lunny Xiao 2014-03-29 19:59:02 +08:00
parent 8282828820
commit ec1b801732
2 changed files with 7 additions and 3 deletions

View File

@ -64,7 +64,7 @@ func (a Action) GetContent() string {
} }
// CommitRepoAction adds new action for committing repository. // CommitRepoAction adds new action for committing repository.
func CommitRepoAction(userId int64, userName string, func CommitRepoAction(userId int64, userName, actEmail string,
repoId int64, repoName string, refName string, commit *base.PushCommits) error { 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)
@ -74,7 +74,7 @@ func CommitRepoAction(userId int64, userName string,
return err return err
} }
if err = NotifyWatchers(&Action{ActUserId: userId, ActUserName: userName, ActEmail: "", 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: OP_COMMIT_REPO, Content: string(bs), RepoId: repoId, RepoName: repoName, RefName: refName}); err != nil {
log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName) log.Error("action.CommitRepoAction(notify watchers): %d/%s", userId, repoName)
return err return err

View File

@ -132,8 +132,12 @@ func runUpdate(c *cli.Context) {
commits := make([]*base.PushCommit, 0) commits := make([]*base.PushCommit, 0)
var maxCommits = 3 var maxCommits = 3
var actEmail string
for e := l.Front(); e != nil; e = e.Next() { for e := l.Front(); e != nil; e = e.Next() {
commit := e.Value.(*git.Commit) commit := e.Value.(*git.Commit)
if actEmail == "" {
actEmail = commit.Committer.Email
}
commits = append(commits, commits = append(commits,
&base.PushCommit{commit.Id().String(), &base.PushCommit{commit.Id().String(),
commit.Message(), commit.Message(),
@ -145,7 +149,7 @@ func runUpdate(c *cli.Context) {
} }
//commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()}) //commits = append(commits, []string{lastCommit.Id().String(), lastCommit.Message()})
if err = models.CommitRepoAction(int64(sUserId), userName, if err = models.CommitRepoAction(int64(sUserId), userName, actEmail,
repos.Id, repoName, git.BranchName(refName), &base.PushCommits{l.Len(), commits}); err != nil { repos.Id, repoName, git.BranchName(refName), &base.PushCommits{l.Len(), commits}); err != nil {
log.Error("runUpdate.models.CommitRepoAction: %v", err) log.Error("runUpdate.models.CommitRepoAction: %v", err)
} }