Skip to content

Commit 8730b09

Browse files
zeripathlafrikstechknowlogick
authored
Add debug option to hooks (#11624)
Signed-off-by: Andrew Thornton <[email protected]> Co-authored-by: Lauris BH <[email protected]> Co-authored-by: techknowlogick <[email protected]>
1 parent 560744f commit 8730b09

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

cmd/hook.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,33 @@ var (
4646
Usage: "Delegate pre-receive Git hook",
4747
Description: "This command should only be called by Git",
4848
Action: runHookPreReceive,
49+
Flags: []cli.Flag{
50+
cli.BoolFlag{
51+
Name: "debug",
52+
},
53+
},
4954
}
5055
subcmdHookUpdate = cli.Command{
5156
Name: "update",
5257
Usage: "Delegate update Git hook",
5358
Description: "This command should only be called by Git",
5459
Action: runHookUpdate,
60+
Flags: []cli.Flag{
61+
cli.BoolFlag{
62+
Name: "debug",
63+
},
64+
},
5565
}
5666
subcmdHookPostReceive = cli.Command{
5767
Name: "post-receive",
5868
Usage: "Delegate post-receive Git hook",
5969
Description: "This command should only be called by Git",
6070
Action: runHookPostReceive,
71+
Flags: []cli.Flag{
72+
cli.BoolFlag{
73+
Name: "debug",
74+
},
75+
},
6176
}
6277
)
6378

@@ -138,7 +153,7 @@ func runHookPreReceive(c *cli.Context) error {
138153
return nil
139154
}
140155

141-
setup("hooks/pre-receive.log", false)
156+
setup("hooks/pre-receive.log", c.Bool("debug"))
142157

143158
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
144159
if setting.OnlyAllowPushIfGiteaEnvironmentSet {
@@ -273,7 +288,7 @@ func runHookPostReceive(c *cli.Context) error {
273288
return nil
274289
}
275290

276-
setup("hooks/post-receive.log", false)
291+
setup("hooks/post-receive.log", c.Bool("debug"))
277292

278293
if len(os.Getenv("SSH_ORIGINAL_COMMAND")) == 0 {
279294
if setting.OnlyAllowPushIfGiteaEnvironmentSet {

0 commit comments

Comments
 (0)