aboutsummaryrefslogtreecommitdiff
path: root/update.go
diff options
context:
space:
mode:
authorMeaglith Ma <genedna@gmail.com>2014-03-31 17:23:37 +0800
committerMeaglith Ma <genedna@gmail.com>2014-03-31 17:23:37 +0800
commit1a247340dbea3404431f60a24bb8f8d06d94b1e9 (patch)
tree80d3ecab43506e03405c742a84dcc61f474e2212 /update.go
parent9047cadcd33f95eebafa2f794b895c8406eb80c5 (diff)
parentdd9fb807a46db120ef800d7465f50a73a86df288 (diff)
Merge pull request #1 from gogits/master
Sync to lastest
Diffstat (limited to 'update.go')
-rw-r--r--update.go20
1 files changed, 17 insertions, 3 deletions
diff --git a/update.go b/update.go
index faec0029..e36dc223 100644
--- a/update.go
+++ b/update.go
@@ -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)
}