diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-16 02:53:41 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-16 02:53:41 -0400 |
commit | c3e0554fd77f976b58a8da10d4878353bb895a78 (patch) | |
tree | 98199e67fe35812eb68427c310416e4eaa840a56 /update.go | |
parent | 50df58a893b745abff74bdcbb9be3fc0d10d21f4 (diff) | |
download | gitea-c3e0554fd77f976b58a8da10d4878353bb895a78.tar.gz gitea-c3e0554fd77f976b58a8da10d4878353bb895a78.zip |
Clean code
Diffstat (limited to 'update.go')
-rw-r--r-- | update.go | 27 |
1 files changed, 20 insertions, 7 deletions
@@ -1,13 +1,19 @@ +// Copyright 2014 The Gogs Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + package main import ( "os" "strconv" - "github.com/gogits/gogs/models" - "github.com/codegangsta/cli" + git "github.com/gogits/git" + + "github.com/gogits/gogs/models" + "github.com/gogits/gogs/modules/log" ) var CmdUpdate = cli.Command{ @@ -41,11 +47,18 @@ func runUpdate(*cli.Context) { if err != nil { return } - sUserId, _ := strconv.Atoi(userId) - sRepoId, _ := strconv.Atoi(repoId) - err = models.CommitRepoAction(int64(sUserId), userName, - int64(sRepoId), repoName, lastCommit.Message()) + sUserId, err := strconv.Atoi(userId) if err != nil { - //TODO: log + log.Error("runUpdate.Parse userId: %v", err) + return + } + sRepoId, err := strconv.Atoi(repoId) + if err != nil { + log.Error("runUpdate.Parse repoId: %v", err) + return + } + if err = models.CommitRepoAction(int64(sUserId), userName, + int64(sRepoId), repoName, lastCommit.Message()); err != nil { + log.Error("runUpdate.models.CommitRepoAction: %v", err) } } |