1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
diff --git a/cmd/ugitd/main.go b/cmd/ugitd/main.go
index afb48cd348805b04c0f4ae04c0d510903740e3d9..6dfa3d9dfefc302d856bf424042d2e9d6444b1e5 100644
--- a/cmd/ugitd/main.go
+++ b/cmd/ugitd/main.go
@@ -143,12 +143,12 @@ fi, err := os.Create(fp)
if err != nil {
return err
}
- fi.WriteString("#!/usr/bin/env bash\n")
- fi.WriteString(fmt.Sprintf("%s pre-receive-hook\n", bin))
- fi.WriteString(fmt.Sprintf(`for hook in %s.d/*; do
+ fmt.Fprintln(fi, "#!/usr/bin/env bash")
+ fmt.Fprintf(fi, "%s pre-receive-hook\n", bin)
+ fmt.Fprintf(fi, `for hook in %s.d/*; do
test -x "${hook}" && test -f "${hook}" || continue
"${hook}"
-done`, fp))
+done`, fp)
fi.Close()
return os.Chmod(fp, 0o755)
@@ -162,7 +162,7 @@ }
opts := make([]*packp.Option, 0)
if pushCount, err := strconv.Atoi(os.Getenv("GIT_PUSH_OPTION_COUNT")); err == nil {
- for idx := 0; idx < pushCount; idx++ {
+ for idx := range pushCount {
opt := os.Getenv(fmt.Sprintf("GIT_PUSH_OPTION_%d", idx))
kv := strings.SplitN(opt, "=", 2)
if len(kv) == 2 {
|