This commit is contained in:
Unknown 2014-03-17 17:00:35 -04:00
parent 6ca32ef44f
commit e656609b0d
7 changed files with 75 additions and 19 deletions

View file

@ -223,6 +223,17 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
return err
}
// hook/post-update
pu, err := os.OpenFile(filepath.Join(repoPath, "hooks", "post-update"), os.O_CREATE|os.O_WRONLY, 0777)
if err != nil {
return err
}
defer pu.Close()
// TODO: Windows .bat
if _, err = pu.WriteString(fmt.Sprintf("#!/usr/bin/env bash\n%s update\n", appPath)); err != nil {
return err
}
// Initialize repository according to user's choice.
fileName := map[string]string{}
if initReadme {
@ -275,11 +286,14 @@ func initRepository(f string, user *User, repo *Repository, initReadme bool, rep
}
}
if len(fileName) == 0 {
return nil
}
// Apply changes and commit.
if err := initRepoCommit(tmpDir, user.NewGitSig()); err != nil {
return err
}
return nil
}