aboutsummaryrefslogtreecommitdiff
path: root/receivepack/hook.go
diff options
context:
space:
mode:
authorGravatar Runxi Yu2026-03-07 22:00:51 +0800
committerGravatar Runxi Yu2026-03-07 22:03:26 +0800
commit7d0f942b3ae4903dded72a9524f6bd4ffa16feb9 (patch)
tree32cbfc7841dc59759618c07905675cc3ece1c5a1 /receivepack/hook.go
parentprotocol/v0v1/server: Add ProgessWriter and ErrorWriter (diff)
signatureNo signature
receivepack: Add HookIO
Diffstat (limited to 'receivepack/hook.go')
-rw-r--r--receivepack/hook.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/receivepack/hook.go b/receivepack/hook.go
index c96911ac..bdb0b087 100644
--- a/receivepack/hook.go
+++ b/receivepack/hook.go
@@ -2,6 +2,7 @@ package receivepack
import (
"context"
+ "io"
"codeberg.org/lindenii/furgit/objectid"
"codeberg.org/lindenii/furgit/objectstore"
@@ -9,6 +10,11 @@ import (
"codeberg.org/lindenii/furgit/refstore"
)
+type HookIO struct {
+ Progress io.Writer
+ Error io.Writer
+}
+
// RefUpdate is one requested reference update presented to a receive-pack hook.
type RefUpdate struct {
Name string
@@ -30,6 +36,7 @@ type HookRequest struct {
QuarantinedObjects objectstore.Store
Updates []RefUpdate
PushOptions []string
+ IO HookIO
}
// Hook decides whether each requested update should proceed.
@@ -60,6 +67,10 @@ func translateHook(hook Hook) service.Hook {
QuarantinedObjects: req.QuarantinedObjects,
Updates: translatedUpdates,
PushOptions: append([]string(nil), req.PushOptions...),
+ IO: HookIO{
+ Progress: req.IO.Progress,
+ Error: req.IO.Error,
+ },
})
if err != nil {
return nil, err