From 53cb246cdc01f20ff978b53a2918a8f059e13a8a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Thu, 10 Nov 2022 20:08:37 +0800 Subject: [PATCH] fix --- models/migrations/migrations.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index f1f943a2c29e4..2e661531b62b8 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -14,6 +14,7 @@ import ( "regexp" "strings" + "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -513,6 +514,13 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t return nil } + // Some migration tasks depend on the git command + if git.DefaultContext == nil { + if err = git.InitSimple(context.Background()); err != nil { + return err + } + } + // Migrate for i, m := range migrations[v-minDBVersion:] { log.Info("Migration[%d]: %s", v+int64(i), m.Description())