From 1c8c3ea1d6a16eacae1852c24127bd77a7f7ebbe Mon Sep 17 00:00:00 2001 From: oppiliappan Date: Wed, 11 Jun 2025 16:05:19 +0100 Subject: [PATCH] knotserver: setup hooks for forks too Signed-off-by: oppiliappan --- knotserver/routes.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/knotserver/routes.go b/knotserver/routes.go index 70cebf7f..baeff136 100644 --- a/knotserver/routes.go +++ b/knotserver/routes.go @@ -674,17 +674,13 @@ func (h *Handle) NewRepo(w http.ResponseWriter, r *http.Request) { return } - err = hook.SetupRepo(hook.Config( - hook.WithScanPath(h.c.Repo.ScanPath), - hook.WithInternalApi(h.c.Server.InternalListenAddr), - ), + hook.SetupRepo( + hook.Config( + hook.WithScanPath(h.c.Repo.ScanPath), + hook.WithInternalApi(h.c.Server.InternalListenAddr), + ), repoPath, ) - if err != nil { - l.Error("setting up hooks", "error", err.Error()) - writeError(w, err.Error(), http.StatusInternalServerError) - return - } w.WriteHeader(http.StatusNoContent) } @@ -934,6 +930,14 @@ func (h *Handle) RepoFork(w http.ResponseWriter, r *http.Request) { return } + hook.SetupRepo( + hook.Config( + hook.WithScanPath(h.c.Repo.ScanPath), + hook.WithInternalApi(h.c.Server.InternalListenAddr), + ), + repoPath, + ) + w.WriteHeader(http.StatusNoContent) } -- 2.51.2