From e4d6b5d488981d78417e9c85eda8226ebb8b7e37 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sat, 15 Aug 2015 01:13:23 +0800 Subject: [PATCH] Creates hooks directory when init update hook --- README.md | 2 +- models/repo.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3703fdb1d7..96f67d6a57 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Gogs (Go Git Service) is a painless self-hosted Git service. ![Demo](http://gogs.qiniudn.com/gogs_demo.gif) -##### Current version: 0.6.4 Beta +##### Current version: 0.6.5 Beta ### NOTICES diff --git a/models/repo.go b/models/repo.go index bad6f38680..9aed7d7d33 100644 --- a/models/repo.go +++ b/models/repo.go @@ -458,7 +458,9 @@ func initRepoCommit(tmpPath string, sig *git.Signature) (err error) { } func createUpdateHook(repoPath string) error { - return ioutil.WriteFile(path.Join(repoPath, "hooks/update"), + hookPath := path.Join(repoPath, "hooks/update") + os.MkdirAll(path.Dir(hookPath), os.ModePerm) + return ioutil.WriteFile(hookPath, []byte(fmt.Sprintf(_TPL_UPDATE_HOOK, setting.ScriptType, "\""+appPath+"\"", setting.CustomConf)), 0777) }