diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-16 22:32:33 +0800 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2014-03-16 22:32:33 +0800 |
commit | f620f23c35f76a97f945f210638d4be8920e189e (patch) | |
tree | ee1326b175cd59dd8b9fdffe35294b30abc8802b /models | |
parent | 795dad786189aeba9c61452e395bb4ecf5fc2cb9 (diff) | |
download | gitea-f620f23c35f76a97f945f210638d4be8920e189e.tar.gz gitea-f620f23c35f76a97f945f210638d4be8920e189e.zip |
add post update
Diffstat (limited to 'models')
-rw-r--r-- | models/repo.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/models/repo.go b/models/repo.go index 125abfc342..3d6255a356 100644 --- a/models/repo.go +++ b/models/repo.go @@ -223,7 +223,18 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep return err } - return nil + pu, err := os.OpenFile(filepath.Join(f, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777) + if err != nil { + return err + } + defer pu.Close() + ep, err := exePath() + if err != nil { + return err + } + _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update\n", ep)) + + return err } func GetRepositoryByName(user *User, repoName string) (*Repository, error) { |