|
|
@ -60,8 +60,14 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) { |
|
|
|
oldHookPath := filepath.Join(hookDir, hookName) |
|
|
|
oldHookPath := filepath.Join(hookDir, hookName) |
|
|
|
newHookPath := filepath.Join(hookDir, hookName+".d", "gitea") |
|
|
|
newHookPath := filepath.Join(hookDir, hookName+".d", "gitea") |
|
|
|
|
|
|
|
|
|
|
|
if err = os.MkdirAll(filepath.Join(hookDir, hookName+".d"), os.ModePerm); err != nil { |
|
|
|
customHooksDir := filepath.Join(hookDir, hookName+".d") |
|
|
|
return fmt.Errorf("create hooks dir '%s': %v", filepath.Join(hookDir, hookName+".d"), err) |
|
|
|
// 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
|
|
|
|
// WARNING: Old server-side hooks will be moved to sub directory with the same name
|
|
|
|