diff options
author | Unknwon <u@gogs.io> | 2017-02-14 16:50:16 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2017-02-14 16:50:16 -0500 |
commit | 0f32aeec702c0adae5d97d0c3f3f75812c7263a1 (patch) | |
tree | 64a7e40dbc6af90365e86edd83f25388b60d35ac | |
parent | 78145cd16668e3148cca209241e0a4fd22e2f68a (diff) |
migration: adjust rule to prevent migrate wrong hook file
-rw-r--r-- | models/migrations/v15.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/models/migrations/v15.go b/models/migrations/v15.go index b9e1f932..adc38309 100644 --- a/models/migrations/v15.go +++ b/models/migrations/v15.go @@ -75,7 +75,7 @@ func generateAndMigrateGitHooks(x *xorm.Engine) (err error) { // Gogs didn't allow user to set custom update hook thus no migration for it. // In case user runs this migration multiple times, and custom hook exists, // we assume it's been migrated already. - if hookName != "update" && com.IsFile(oldHookPath) && !com.IsExist(newHookPath) { + if hookName != "update" && com.IsFile(oldHookPath) && !com.IsExist(customHookDir) { os.MkdirAll(customHookDir, os.ModePerm) if err = os.Rename(oldHookPath, newHookPath); err != nil { return fmt.Errorf("move hook file to custom directory '%s' -> '%s': %v", oldHookPath, newHookPath, err) |