Skip to content

Commit

Permalink
Fix git.Init for doctor sub-command (go-gitea#20782)
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoguang authored and Sysoev, Vladimir committed Aug 28, 2022
1 parent 7e6c154 commit a087e3e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 0 additions & 6 deletions cmd/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/migrations"
"code.gitea.io/gitea/modules/doctor"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"

Expand Down Expand Up @@ -128,11 +127,6 @@ func runDoctor(ctx *cli.Context) error {
stdCtx, cancel := installSignals()
defer cancel()

// some doctor sub-commands need to use git command
if err := git.InitFull(stdCtx); err != nil {
return err
}

// Silence the default loggers
log.DelNamedLogger("console")
log.DelNamedLogger(log.DEFAULT)
Expand Down
7 changes: 6 additions & 1 deletion modules/doctor/doctor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"strings"

"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
)
Expand Down Expand Up @@ -49,7 +50,11 @@ func initDBDisableConsole(ctx context.Context, disableConsole bool) error {

setting.NewXORMLogService(disableConsole)
if err := db.InitEngine(ctx); err != nil {
return fmt.Errorf("models.SetEngine: %v", err)
return fmt.Errorf("db.InitEngine: %w", err)
}
// some doctor sub-commands need to use git command
if err := git.InitFull(ctx); err != nil {
return fmt.Errorf("git.InitFull: %w", err)
}
return nil
}
Expand Down

0 comments on commit a087e3e

Please sign in to comment.