File tree Expand file tree Collapse file tree 6 files changed +21
-0
lines changed
integration/migration-test Expand file tree Collapse file tree 6 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import (
16
16
"code.gitea.io/gitea/models/unittest"
17
17
"code.gitea.io/gitea/modules/base"
18
18
"code.gitea.io/gitea/modules/git"
19
+ "code.gitea.io/gitea/modules/gitrepo"
19
20
"code.gitea.io/gitea/modules/log"
20
21
"code.gitea.io/gitea/modules/setting"
21
22
"code.gitea.io/gitea/modules/testlogger"
@@ -155,6 +156,10 @@ func MainTest(m *testing.M) {
155
156
fmt .Printf ("Unable to InitFull: %v\n " , err )
156
157
os .Exit (1 )
157
158
}
159
+ if err = gitrepo .Init (context .Background ()); err != nil {
160
+ fmt .Printf ("Unable to InitFull: %v\n " , err )
161
+ os .Exit (1 )
162
+ }
158
163
setting .LoadDBSetting ()
159
164
setting .InitLoggersForTest ()
160
165
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import (
17
17
"code.gitea.io/gitea/modules/base"
18
18
"code.gitea.io/gitea/modules/cache"
19
19
"code.gitea.io/gitea/modules/git"
20
+ "code.gitea.io/gitea/modules/gitrepo"
20
21
"code.gitea.io/gitea/modules/log"
21
22
"code.gitea.io/gitea/modules/setting"
22
23
"code.gitea.io/gitea/modules/setting/config"
@@ -174,6 +175,9 @@ func MainTest(m *testing.M, testOpts ...*TestOptions) {
174
175
if err = git .InitFull (context .Background ()); err != nil {
175
176
fatalTestError ("git.Init: %v\n " , err )
176
177
}
178
+ if err = gitrepo .Init (context .Background ()); err != nil {
179
+ fatalTestError ("gitrepo.Init: %v\n " , err )
180
+ }
177
181
ownerDirs , err := os .ReadDir (setting .RepoRootPath )
178
182
if err != nil {
179
183
fatalTestError ("unable to read the new repo root: %v\n " , err )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
14
14
"code.gitea.io/gitea/modules/cache"
15
15
"code.gitea.io/gitea/modules/eventsource"
16
16
"code.gitea.io/gitea/modules/git"
17
+ "code.gitea.io/gitea/modules/gitrepo"
17
18
"code.gitea.io/gitea/modules/highlight"
18
19
"code.gitea.io/gitea/modules/log"
19
20
"code.gitea.io/gitea/modules/markup"
@@ -113,6 +114,7 @@ func InitWebInstallPage(ctx context.Context) {
113
114
// InitWebInstalled is for global installed configuration.
114
115
func InitWebInstalled (ctx context.Context ) {
115
116
mustInitCtx (ctx , git .InitFull )
117
+ mustInitCtx (ctx , gitrepo .Init )
116
118
log .Info ("Git version: %s (home: %s)" , git .DefaultFeatures ().VersionInfo (), git .HomeDir ())
117
119
if ! git .DefaultFeatures ().SupportHashSha256 {
118
120
log .Warn ("sha256 hash support is disabled - requires Git >= 2.42." + util .Iif (git .DefaultFeatures ().UsingGogit , " Gogit is currently unsupported." , "" ))
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import (
12
12
13
13
"code.gitea.io/gitea/models/db"
14
14
"code.gitea.io/gitea/modules/git"
15
+ "code.gitea.io/gitea/modules/gitrepo"
15
16
"code.gitea.io/gitea/modules/log"
16
17
"code.gitea.io/gitea/modules/setting"
17
18
"code.gitea.io/gitea/modules/storage"
@@ -39,6 +40,9 @@ func initDBSkipLogger(ctx context.Context) error {
39
40
if err := git .InitFull (ctx ); err != nil {
40
41
return fmt .Errorf ("git.InitFull: %w" , err )
41
42
}
43
+ if err := gitrepo .Init (ctx ); err != nil {
44
+ return fmt .Errorf ("gitrepo.Init: %w" , err )
45
+ }
42
46
return nil
43
47
}
44
48
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import (
24
24
"code.gitea.io/gitea/modules/base"
25
25
"code.gitea.io/gitea/modules/charset"
26
26
"code.gitea.io/gitea/modules/git"
27
+ "code.gitea.io/gitea/modules/gitrepo"
27
28
"code.gitea.io/gitea/modules/log"
28
29
"code.gitea.io/gitea/modules/setting"
29
30
"code.gitea.io/gitea/modules/testlogger"
@@ -87,6 +88,7 @@ func initMigrationTest(t *testing.T) func() {
87
88
}
88
89
89
90
assert .NoError (t , git .InitFull (context .Background ()))
91
+ assert .NoError (t , gitrepo .Init (context .Background ()))
90
92
setting .LoadDBSetting ()
91
93
setting .InitLoggersForTest ()
92
94
return deferFn
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
18
18
"code.gitea.io/gitea/models/unittest"
19
19
"code.gitea.io/gitea/modules/base"
20
20
"code.gitea.io/gitea/modules/git"
21
+ "code.gitea.io/gitea/modules/gitrepo"
21
22
"code.gitea.io/gitea/modules/graceful"
22
23
"code.gitea.io/gitea/modules/log"
23
24
repo_module "code.gitea.io/gitea/modules/repository"
@@ -83,6 +84,9 @@ func InitTest(requireGitea bool) {
83
84
if err := git .InitFull (context .Background ()); err != nil {
84
85
log .Fatal ("git.InitOnceWithSync: %v" , err )
85
86
}
87
+ if err := gitrepo .Init (context .Background ()); err != nil {
88
+ log .Fatal ("gitrepo.Init: %v" , err )
89
+ }
86
90
87
91
setting .LoadDBSetting ()
88
92
if err := storage .Init (); err != nil {
You can’t perform that action at this time.
0 commit comments