Skip to content

Commit 87d05d3

Browse files
authored
Init git module before database migration (#21764) (#21765)
Backport #21764 Some database migrations depend on the git module.
1 parent b9dcf99 commit 87d05d3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

models/migrations/migrations.go

+8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"regexp"
1515
"strings"
1616

17+
"code.gitea.io/gitea/modules/git"
1718
"code.gitea.io/gitea/modules/log"
1819
"code.gitea.io/gitea/modules/setting"
1920

@@ -513,6 +514,13 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t
513514
return nil
514515
}
515516

517+
// Some migration tasks depend on the git command
518+
if git.DefaultContext == nil {
519+
if err = git.InitSimple(context.Background()); err != nil {
520+
return err
521+
}
522+
}
523+
516524
// Migrate
517525
for i, m := range migrations[v-minDBVersion:] {
518526
log.Info("Migration[%d]: %s", v+int64(i), m.Description())

0 commit comments

Comments
 (0)