mirror of
https://github.com/harness/drone.git
synced 2025-05-21 11:29:52 +08:00
[MISC] disable 'update' git hook (#181)
This commit is contained in:
parent
79318bd522
commit
5e3837b9cf
@ -39,7 +39,11 @@ var (
|
||||
Email: "system@gitness",
|
||||
}
|
||||
|
||||
gitServerHookNames = []string{"pre-receive", "update", "post-receive"}
|
||||
gitServerHookNames = []string{
|
||||
"pre-receive",
|
||||
// "update", // update is disabled for performance reasons (called once for every ref)
|
||||
"post-receive",
|
||||
}
|
||||
|
||||
// gitSHARegex defines the valid SHA format accepted by GIT (full form and short forms).
|
||||
// Note: as of now SHA is at most 40 characters long, but in the future it's moving to sha256
|
||||
|
@ -68,8 +68,21 @@ func (c *CLI) PreReceive(ctx context.Context) error {
|
||||
|
||||
// Update executes the update git hook.
|
||||
func (c *CLI) Update(ctx context.Context, ref string, oldSHA string, newSHA string) error {
|
||||
// Skip update hook as we don't have any per branch operations, and pre-receive is more performant!
|
||||
return nil
|
||||
in := &githook.UpdateInput{
|
||||
BaseInput: githook.BaseInput{
|
||||
RepoID: c.payload.RepoID,
|
||||
PrincipalID: c.payload.PrincipalID,
|
||||
},
|
||||
RefUpdate: githook.ReferenceUpdate{
|
||||
Ref: ref,
|
||||
Old: oldSHA,
|
||||
New: newSHA,
|
||||
},
|
||||
}
|
||||
|
||||
out, err := c.client.Update(ctx, in)
|
||||
|
||||
return handleServerHookOutput(out, err)
|
||||
}
|
||||
|
||||
// PostReceive executes the post-receive git hook.
|
||||
|
Loading…
Reference in New Issue
Block a user