aboutsummaryrefslogtreecommitdiff
path: root/models/migrations
diff options
context:
space:
mode:
authorUnknwon <u@gogs.io>2017-02-15 05:25:51 -0500
committerUnknwon <u@gogs.io>2017-02-15 05:25:51 -0500
commit0f6e4641269aecf4d2c20abf47c101e2721627fd (patch)
treebd27c2db0c26178fc7d4b93f228160c13630c575 /models/migrations
parent6132a82287a1300052a357ce29d69f54f1de0159 (diff)
migration: should regenerate wiki hook files (#1623)
Diffstat (limited to 'models/migrations')
-rw-r--r--models/migrations/v15.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/models/migrations/v15.go b/models/migrations/v15.go
index adc38309..82cd9250 100644
--- a/models/migrations/v15.go
+++ b/models/migrations/v15.go
@@ -62,11 +62,13 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) {
return nil
}
- repoPath := filepath.Join(setting.RepoRootPath, strings.ToLower(user.Name), strings.ToLower(repo.Name)) + ".git"
+ repoBase := filepath.Join(setting.RepoRootPath, strings.ToLower(user.Name), strings.ToLower(repo.Name))
+ repoPath := repoBase + ".git"
log.Trace("[%04d]: %s", idx, repoPath)
hookDir := filepath.Join(repoPath, "hooks")
customHookDir := filepath.Join(repoPath, "custom_hooks")
+ wikiHookDir := filepath.Join(repoBase+".wiki.git", "hooks")
for i, hookName := range hookNames {
oldHookPath := filepath.Join(hookDir, hookName)
@@ -82,9 +84,14 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) {
}
}
- if err = ioutil.WriteFile(oldHookPath, []byte(hookTpls[i]), 0777); err != nil {
+ if err = ioutil.WriteFile(oldHookPath, []byte(hookTpls[i]), os.ModePerm); err != nil {
return fmt.Errorf("write hook file '%s': %v", oldHookPath, err)
}
+
+ wikiHookPath := filepath.Join(wikiHookDir, hookName)
+ if err = ioutil.WriteFile(wikiHookPath, []byte(hookTpls[i]), os.ModePerm); err != nil {
+ return fmt.Errorf("write wiki hook file '%s': %v", wikiHookPath, err)
+ }
}
return nil
})