diff options
author | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
---|---|---|
committer | Meaglith Ma <genedna@gmail.com> | 2014-03-31 17:23:37 +0800 |
commit | 1a247340dbea3404431f60a24bb8f8d06d94b1e9 (patch) | |
tree | 80d3ecab43506e03405c742a84dcc61f474e2212 /update.go | |
parent | 9047cadcd33f95eebafa2f794b895c8406eb80c5 (diff) | |
parent | dd9fb807a46db120ef800d7465f50a73a86df288 (diff) |
Merge pull request #1 from gogits/master
Sync to lastest
Diffstat (limited to 'update.go')
-rw-r--r-- | update.go | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -32,6 +32,12 @@ gogs serv provide access auth for repositories`, func runUpdate(c *cli.Context) { base.NewConfigContext() models.LoadModelsConfig() + + if models.UseSQLite3 { + execDir, _ := base.ExecDir() + os.Chdir(execDir) + } + models.SetEngine() w, _ := os.Create("update.log") @@ -130,18 +136,26 @@ func runUpdate(c *cli.Context) { return } - commits := make([][]string, 0) + commits := make([]*base.PushCommit, 0) var maxCommits = 3 + var actEmail string for e := l.Front(); e != nil; e = e.Next() { commit := e.Value.(*git.Commit) - commits = append(commits, []string{commit.Id().String(), commit.Message()}) + if actEmail == "" { + actEmail = commit.Committer.Email + } + commits = append(commits, + &base.PushCommit{commit.Id().String(), + commit.Message(), + commit.Author.Email, + commit.Author.Name}) if len(commits) >= maxCommits { break } } //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 { log.Error("runUpdate.models.CommitRepoAction: %v", err) } |