Skip to content

Commit 752c3fe

Browse files
committed
Also fix go-gitea#8982 - need to read settings before you check their value
1 parent 7bfb83e commit 752c3fe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cmd/hook.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ var (
5959
)
6060

6161
func runHookPreReceive(c *cli.Context) error {
62+
setup("hooks/pre-receive.log", false)
63+
6264
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
6365
if setting.OnlyAllowPushIfGiteaEnvironmentSet {
6466
fail(`Rejecting changes as Gitea environment not set.
@@ -69,8 +71,6 @@ Gitea or set your environment appropriately.`, "")
6971
}
7072
}
7173

72-
setup("hooks/pre-receive.log", false)
73-
7474
// the environment setted on serv command
7575
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
7676
username := os.Getenv(models.EnvRepoUsername)
@@ -197,6 +197,8 @@ Gitea or set your environment appropriately.`, "")
197197
}
198198

199199
func runHookPostReceive(c *cli.Context) error {
200+
setup("hooks/post-receive.log", false)
201+
200202
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
201203
if setting.OnlyAllowPushIfGiteaEnvironmentSet {
202204
fail(`Rejecting changes as Gitea environment not set.
@@ -207,8 +209,6 @@ Gitea or set your environment appropriately.`, "")
207209
}
208210
}
209211

210-
setup("hooks/post-receive.log", false)
211-
212212
// the environment setted on serv command
213213
repoUser := os.Getenv(models.EnvRepoUsername)
214214
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")

0 commit comments

Comments
 (0)