]> source.dussan.org Git - gitea.git/commitdiff
Locating issue of git push not update repo last updated time
authorUnknown <joe2010xtmf@163.com>
Mon, 24 Mar 2014 13:32:24 +0000 (09:32 -0400)
committerUnknown <joe2010xtmf@163.com>
Mon, 24 Mar 2014 13:32:24 +0000 (09:32 -0400)
models/action.go
modules/base/conf.go
serve.go

index 9471e9810e556ca5d95d436d5fcfa7084449b9f8..44d7aea8ca4de8134893bcac5601bd082e3fda07 100644 (file)
@@ -59,14 +59,18 @@ func (a Action) GetContent() string {
 // CommitRepoAction records action for commit repository.
 func CommitRepoAction(userId int64, userName string,
        repoId int64, repoName string, refName string, commits *base.PushCommits) error {
+       log.Trace("action.CommitRepoAction: %d/%s", userId, repoName)
+
        bs, err := json.Marshal(commits)
        if err != nil {
+               log.Error("action.CommitRepoAction(json): %d/%s", userId, repoName)
                return err
        }
 
        // Add feeds for user self and all watchers.
        watches, err := GetWatches(repoId)
        if err != nil {
+               log.Error("action.CommitRepoAction(get watches): %d/%s", userId, repoName)
                return err
        }
        watches = append(watches, Watch{UserId: userId})
@@ -86,22 +90,23 @@ func CommitRepoAction(userId int64, userName string,
                        RepoName:    repoName,
                        RefName:     refName,
                })
+               if err != nil {
+                       log.Error("action.CommitRepoAction(notify watches): %d/%s", userId, repoName)
+               }
                return err
        }
 
        // Update repository last update time.
        repo, err := GetRepositoryByName(userId, repoName)
        if err != nil {
-               log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repo.LowerName)
+               log.Error("action.CommitRepoAction(GetRepositoryByName): %d/%s", userId, repoName)
                return err
        }
        repo.IsBare = false
        if err = UpdateRepository(repo); err != nil {
-               log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repo.LowerName)
+               log.Error("action.CommitRepoAction(UpdateRepository): %d/%s", userId, repoName)
                return err
        }
-
-       log.Trace("action.CommitRepoAction: %d/%s", userId, repo.LowerName)
        return nil
 }
 
index 2bf529d9d11299c6957f92b6628bdf1f01039843..b4e0de97bdc853bc93d64b233fd5e5a51db1f659 100644 (file)
@@ -100,7 +100,7 @@ func newService() {
        Service.EnableCacheAvatar = Cfg.MustBool("service", "ENABLE_CACHE_AVATAR", false)
 }
 
-func newLogService() {
+func NewLogService() {
        // Get and check log mode.
        LogMode = Cfg.MustValue("log", "MODE", "console")
        modeSec := "log." + LogMode
@@ -125,7 +125,7 @@ func newLogService() {
                logPath := Cfg.MustValue(modeSec, "FILE_NAME", "log/gogs.log")
                os.MkdirAll(path.Dir(logPath), os.ModePerm)
                LogConfig = fmt.Sprintf(
-                       `{"level":%s,"filename":%s,"rotate":%v,"maxlines":%d,"maxsize",%d,"daily":%v,"maxdays":%d}`, level,
+                       `{"level":%s,"filename":"%s","rotate":%v,"maxlines":%d,"maxsize":%d,"daily":%v,"maxdays":%d}`, level,
                        logPath,
                        Cfg.MustBool(modeSec, "LOG_ROTATE", true),
                        Cfg.MustInt(modeSec, "MAX_LINES", 1000000),
@@ -133,20 +133,20 @@ func newLogService() {
                        Cfg.MustBool(modeSec, "DAILY_ROTATE", true),
                        Cfg.MustInt(modeSec, "MAX_DAYS", 7))
        case "conn":
-               LogConfig = fmt.Sprintf(`{"level":%s,"reconnectOnMsg":%v,"reconnect":%v,"net":%s,"addr":%s}`, level,
+               LogConfig = fmt.Sprintf(`{"level":"%s","reconnectOnMsg":%v,"reconnect":%v,"net":"%s","addr":"%s"}`, level,
                        Cfg.MustBool(modeSec, "RECONNECT_ON_MSG", false),
                        Cfg.MustBool(modeSec, "RECONNECT", false),
                        Cfg.MustValue(modeSec, "PROTOCOL", "tcp"),
                        Cfg.MustValue(modeSec, "ADDR", ":7020"))
        case "smtp":
-               LogConfig = fmt.Sprintf(`{"level":%s,"username":%s,"password":%s,"host":%s,"sendTos":%s,"subject":%s}`, level,
+               LogConfig = fmt.Sprintf(`{"level":"%s","username":"%s","password":"%s","host":"%s","sendTos":"%s","subject":"%s"}`, level,
                        Cfg.MustValue(modeSec, "USER", "example@example.com"),
                        Cfg.MustValue(modeSec, "PASSWD", "******"),
                        Cfg.MustValue(modeSec, "HOST", "127.0.0.1:25"),
                        Cfg.MustValue(modeSec, "RECEIVERS", "[]"),
                        Cfg.MustValue(modeSec, "SUBJECT", "Diagnostic message from serve"))
        case "database":
-               LogConfig = fmt.Sprintf(`{"level":%s,"driver":%s,"conn":%s}`, level,
+               LogConfig = fmt.Sprintf(`{"level":"%s","driver":"%s","conn":"%s"}`, level,
                        Cfg.MustValue(modeSec, "Driver"),
                        Cfg.MustValue(modeSec, "CONN"))
        }
@@ -259,11 +259,16 @@ func NewConfigContext() {
        Cfg.BlockMode = false
 
        cfgPath = filepath.Join(workDir, "custom/conf/app.ini")
-       if com.IsFile(cfgPath) {
-               if err = Cfg.AppendFiles(cfgPath); err != nil {
-                       fmt.Printf("Cannot load config file '%s'\n", cfgPath)
-                       os.Exit(2)
-               }
+       if !com.IsFile(cfgPath) {
+               fmt.Println("Custom configuration not found(custom/conf/app.ini)\n" +
+                       "Please create it and make your own configuration!")
+               os.Exit(2)
+
+       }
+
+       if err = Cfg.AppendFiles(cfgPath); err != nil {
+               fmt.Printf("Cannot load config file '%s'\n", cfgPath)
+               os.Exit(2)
        }
 
        AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service")
@@ -291,7 +296,7 @@ func NewConfigContext() {
 
 func NewServices() {
        newService()
-       newLogService()
+       NewLogService()
        newCacheService()
        newSessionService()
        newMailService()
index b84fa2a4e501ba512e76c543619545db3fbe0411..5b2f2e972aa2c13db4588541a114c11a61f76bc6 100644 (file)
--- a/serve.go
+++ b/serve.go
@@ -68,6 +68,7 @@ func runServ(k *cli.Context) {
        base.NewConfigContext()
        models.LoadModelsConfig()
        models.NewEngine()
+       base.NewLogService()
 
        keys := strings.Split(os.Args[2], "-")
        if len(keys) != 2 {