Skip to content

Commit fd4c82e

Browse files
committed
also do models.RewriteAllPublicKeys
1 parent 10ef557 commit fd4c82e

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

modules/appstate/file.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func (f *FileStore) Get(item StateItem) error {
3535
return e
3636
}
3737

38-
//Set saves the state item
38+
// Set saves the state item
3939
func (f *FileStore) Set(item StateItem) error {
4040
b, e := json.Marshal(item)
4141
if e != nil {
@@ -44,12 +44,12 @@ func (f *FileStore) Set(item StateItem) error {
4444
return ioutil.WriteFile(f.genFilePath(item), b, fs.FileMode(0644))
4545
}
4646

47-
//Delete removes the state item
47+
// Delete removes the state item
4848
func (f *FileStore) Delete(item StateItem) error {
4949
return os.Remove(f.genFilePath(item))
5050
}
5151

52-
//NewFileStore returns a new file store
52+
// NewFileStore returns a new file store
5353
func NewFileStore(path string) (*FileStore, error) {
5454
_ = os.Mkdir(path, fs.FileMode(0755))
5555
if _, err := os.Stat(path); err != nil {

modules/appstate/item_runtime.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ type RuntimeState struct {
99
LastAppPath string `json:"last_app_path"`
1010
}
1111

12-
//Name returns the item name
12+
// Name returns the item name
1313
func (a RuntimeState) Name() string {
1414
return "runtime-state"
1515
}

routers/init.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,17 +74,18 @@ func InitGitServices() {
7474
guaranteeInit(repository.NewContext)
7575
}
7676

77-
func syncAppPathForGitHooks(ctx context.Context) (err error) {
77+
func syncAppPathForGit(ctx context.Context) (err error) {
7878
runtimeState := new(appstate.RuntimeState)
7979
if err = setting.AppState.Get(runtimeState); err != nil {
8080
return err
8181
}
8282
if runtimeState.LastAppPath != setting.AppPath {
8383
log.Info("AppPath changed from '%s' to '%s', sync repository hooks ...", runtimeState.LastAppPath, setting.AppPath)
84-
err = repo_module.SyncRepositoryHooks(ctx)
85-
if err != nil {
86-
return err
87-
}
84+
guaranteeInitCtx(ctx, repo_module.SyncRepositoryHooks)
85+
86+
log.Info("AppPath changed from '%s' to '%s', sync ssh keys ...", runtimeState.LastAppPath, setting.AppPath)
87+
guaranteeInit(models.RewriteAllPublicKeys)
88+
8889
runtimeState.LastAppPath = setting.AppPath
8990
return setting.AppState.Set(runtimeState)
9091
}
@@ -148,7 +149,7 @@ func GlobalInit(ctx context.Context) {
148149
guaranteeInit(repo_migrations.Init)
149150
eventsource.GetManager().Init()
150151

151-
guaranteeInitCtx(ctx, syncAppPathForGitHooks)
152+
guaranteeInitCtx(ctx, syncAppPathForGit)
152153

153154
if setting.SSH.StartBuiltinServer {
154155
ssh.Listen(setting.SSH.ListenHost, setting.SSH.ListenPort, setting.SSH.ServerCiphers, setting.SSH.ServerKeyExchanges, setting.SSH.ServerMACs)

0 commit comments

Comments
 (0)