Skip to content

Commit 85781bf

Browse files
arschlesAaron Schlesinger
authored andcommitted
fix(git.go): check error when writing pre-receive hook file
1 parent 4b97b7d commit 85781bf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

pkg/git/git.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,9 @@ func createRepo(c cookoo.Context, repoPath, gitHome string) (bool, error) {
219219

220220
writePath := filepath.Join(repoPath, "hooks", "pre-receive")
221221
pkglog.Debug("Writing pre-receive hook to %s", writePath)
222-
ioutil.WriteFile(writePath, hookByteBuf.Bytes(), 0755)
222+
if err := ioutil.WriteFile(writePath, hookByteBuf.Bytes(), 0755); err != nil {
223+
return false, fmt.Errorf("Cannot write pre-receive hook to %s (%s)", writePath, err)
224+
}
223225

224226
return true, nil
225227
} else if err == nil {

0 commit comments

Comments
 (0)