summaryrefslogtreecommitdiffstats
path: root/models/migrations/v19.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/migrations/v19.go')
-rw-r--r--models/migrations/v19.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/models/migrations/v19.go b/models/migrations/v19.go
index 6e0dbedaa3..0edeb3e92e 100644
--- a/models/migrations/v19.go
+++ b/models/migrations/v19.go
@@ -60,8 +60,14 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) {
oldHookPath := filepath.Join(hookDir, hookName)
newHookPath := filepath.Join(hookDir, hookName+".d", "gitea")
- if err = os.MkdirAll(filepath.Join(hookDir, hookName+".d"), os.ModePerm); err != nil {
- return fmt.Errorf("create hooks dir '%s': %v", filepath.Join(hookDir, hookName+".d"), err)
+ customHooksDir := filepath.Join(hookDir, hookName+".d")
+ // if it's exist, that means you have upgraded ever
+ if com.IsExist(customHooksDir) {
+ continue
+ }
+
+ if err = os.MkdirAll(customHooksDir, os.ModePerm); err != nil {
+ return fmt.Errorf("create hooks dir '%s': %v", customHooksDir, err)
}
// WARNING: Old server-side hooks will be moved to sub directory with the same name