Skip to content

Commit 26b92e3

Browse files
committed
CB/revert: Revert "Sync git hooks when config file path changed (go-gitea#21619) (go-gitea#21625)"
This reverts commit 7a2daae. On initial run, this printed 2022/11/07 02:57:24 routers/init.go:90:syncAppConfForGit() [I] CustomConf changed from '' to '/etc/gitea/conf/app.ini' But for large instances, it's a terrible idea to attempt writing something to every Git repository *before* starting Gitea.
1 parent d1ef071 commit 26b92e3

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

Diff for: modules/appstate/item_runtime.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ package appstate
66

77
// RuntimeState contains app state for runtime, and we can save remote version for update checker here in future
88
type RuntimeState struct {
9-
LastAppPath string `json:"last_app_path"`
10-
LastCustomConf string `json:"last_custom_conf"`
9+
LastAppPath string `json:"last_app_path"`
1110
}
1211

1312
// Name returns the item name

Diff for: routers/init.go

+3-13
Original file line numberDiff line numberDiff line change
@@ -74,31 +74,21 @@ func InitGitServices() {
7474
mustInit(repo_service.Init)
7575
}
7676

77-
func syncAppConfForGit(ctx context.Context) error {
77+
func syncAppPathForGit(ctx context.Context) error {
7878
runtimeState := new(appstate.RuntimeState)
7979
if err := appstate.AppState.Get(runtimeState); err != nil {
8080
return err
8181
}
82-
83-
updated := false
8482
if runtimeState.LastAppPath != setting.AppPath {
8583
log.Info("AppPath changed from '%s' to '%s'", runtimeState.LastAppPath, setting.AppPath)
86-
runtimeState.LastAppPath = setting.AppPath
87-
updated = true
88-
}
89-
if runtimeState.LastCustomConf != setting.CustomConf {
90-
log.Info("CustomConf changed from '%s' to '%s'", runtimeState.LastCustomConf, setting.CustomConf)
91-
runtimeState.LastCustomConf = setting.CustomConf
92-
updated = true
93-
}
9484

95-
if updated {
9685
log.Info("re-sync repository hooks ...")
9786
mustInitCtx(ctx, repo_service.SyncRepositoryHooks)
9887

9988
log.Info("re-write ssh public keys ...")
10089
mustInit(asymkey_model.RewriteAllPublicKeys)
10190

91+
runtimeState.LastAppPath = setting.AppPath
10292
return appstate.AppState.Set(runtimeState)
10393
}
10494
return nil
@@ -163,7 +153,7 @@ func GlobalInitInstalled(ctx context.Context) {
163153
mustInit(repo_migrations.Init)
164154
eventsource.GetManager().Init()
165155

166-
mustInitCtx(ctx, syncAppConfForGit)
156+
mustInitCtx(ctx, syncAppPathForGit)
167157

168158
mustInit(ssh.Init)
169159

0 commit comments

Comments
 (0)