浏览代码

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>
tags/v1.13.0-rc1
zeripath 4 年前
父节点
当前提交
8730b091e3
没有帐户链接到提交者的电子邮件
共有 1 个文件被更改,包括 17 次插入2 次删除
  1. 17
    2
      cmd/hook.go

+ 17
- 2
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 {

正在加载...
取消
保存