mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Backport #21764 Some database migrations depend on the git module.
This commit is contained in:
		@@ -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"
 | 
			
		||||
 | 
			
		||||
@@ -496,6 +497,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())
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user