diff options
author | Unknwon <u@gogs.io> | 2015-08-26 18:03:30 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-08-26 18:03:30 +0800 |
commit | 1cb03135b745675e614b0b89ab3fde412276fec1 (patch) | |
tree | c376cdf2235e6061af6bb93c0ac1a53b6a80be28 /modules | |
parent | 2f2bf20aaef444d0167a659c346fb545efbd7921 (diff) | |
download | gitea-1cb03135b745675e614b0b89ab3fde412276fec1.tar.gz gitea-1cb03135b745675e614b0b89ab3fde412276fec1.zip |
new repo git hooks UI
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/hooks.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/git/hooks.go b/modules/git/hooks.go index 5b3c88a931..6a1e09a9be 100644 --- a/modules/git/hooks.go +++ b/modules/git/hooks.go @@ -10,6 +10,8 @@ import ( "os" "path" "strings" + + "github.com/Unknwon/com" ) // hookNames is a list of Git hooks' name that are supported. @@ -81,7 +83,10 @@ func (h *Hook) Name() string { // Update updates hook settings. func (h *Hook) Update() error { if len(strings.TrimSpace(h.Content)) == 0 { - return os.Remove(h.path) + if com.IsExist(h.path) { + return os.Remove(h.path) + } + return nil } return ioutil.WriteFile(h.path, []byte(strings.Replace(h.Content, "\r", "", -1)), os.ModePerm) } |