From 0f32aeec702c0adae5d97d0c3f3f75812c7263a1 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Tue, 14 Feb 2017 16:50:16 -0500 Subject: [PATCH] migration: adjust rule to prevent migrate wrong hook file --- models/migrations/v15.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/migrations/v15.go b/models/migrations/v15.go index b9e1f932a..adc38309e 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)