diff options
author | zeripath <art27@cantab.net> | 2020-05-29 04:04:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-28 23:04:44 -0400 |
commit | 8730b091e3d235ffabd15912cdd95803d2be358b (patch) | |
tree | b841fee4593ba109269c9f718f4c6e2d6ea7bd9d | |
parent | 560744fb3399b33b8006e5a6a54a473696cc5b34 (diff) | |
download | gitea-8730b091e3d235ffabd15912cdd95803d2be358b.tar.gz gitea-8730b091e3d235ffabd15912cdd95803d2be358b.zip |
Add debug option to hooks (#11624)
Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
-rw-r--r-- | cmd/hook.go | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/cmd/hook.go b/cmd/hook.go index fa932087fe..f5658de7cd 100644 --- a/cmd/hook.go +++ b/cmd/hook.go @@ -46,18 +46,33 @@ var ( Usage: "Delegate pre-receive Git hook", Description: "This command should only be called by Git", Action: runHookPreReceive, + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "debug", + }, + }, } subcmdHookUpdate = cli.Command{ Name: "update", Usage: "Delegate update Git hook", Description: "This command should only be called by Git", Action: runHookUpdate, + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "debug", + }, + }, } subcmdHookPostReceive = cli.Command{ Name: "post-receive", Usage: "Delegate post-receive Git hook", Description: "This command should only be called by Git", Action: runHookPostReceive, + Flags: []cli.Flag{ + cli.BoolFlag{ + Name: "debug", + }, + }, } ) @@ -138,7 +153,7 @@ func runHookPreReceive(c *cli.Context) error { return nil } - setup("hooks/pre-receive.log", false) + setup("hooks/pre-receive.log", c.Bool("debug")) if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { if setting.OnlyAllowPushIfGiteaEnvironmentSet { @@ -273,7 +288,7 @@ func runHookPostReceive(c *cli.Context) error { return nil } - setup("hooks/post-receive.log", false) + setup("hooks/post-receive.log", c.Bool("debug")) if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 { if setting.OnlyAllowPushIfGiteaEnvironmentSet { |