summaryrefslogtreecommitdiffstats
path: root/cmd/hook.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/hook.go')
-rw-r--r--cmd/hook.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/cmd/hook.go b/cmd/hook.go
index ebd230999a..aabd9637c2 100644
--- a/cmd/hook.go
+++ b/cmd/hook.go
@@ -59,6 +59,12 @@ var (
)
func runHookPreReceive(c *cli.Context) error {
+ if os.Getenv(models.EnvIsInternal) == "true" {
+ return nil
+ }
+
+ setup("hooks/pre-receive.log", false)
+
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
if setting.OnlyAllowPushIfGiteaEnvironmentSet {
fail(`Rejecting changes as Gitea environment not set.
@@ -69,8 +75,6 @@ Gitea or set your environment appropriately.`, "")
}
}
- setup("hooks/pre-receive.log", false)
-
// the environment setted on serv command
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")
username := os.Getenv(models.EnvRepoUsername)
@@ -186,6 +190,12 @@ func runHookUpdate(c *cli.Context) error {
}
func runHookPostReceive(c *cli.Context) error {
+ if os.Getenv(models.EnvIsInternal) == "true" {
+ return nil
+ }
+
+ setup("hooks/post-receive.log", false)
+
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
if setting.OnlyAllowPushIfGiteaEnvironmentSet {
fail(`Rejecting changes as Gitea environment not set.
@@ -196,8 +206,6 @@ Gitea or set your environment appropriately.`, "")
}
}
- setup("hooks/post-receive.log", false)
-
// the environment setted on serv command
repoUser := os.Getenv(models.EnvRepoUsername)
isWiki := (os.Getenv(models.EnvRepoIsWiki) == "true")