diff --git a/models/repo.go b/models/repo.go index 125abfc3..3d6255a3 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) {