aboutsummaryrefslogtreecommitdiff
path: root/git_hooks_deploy.go
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-04-05 20:52:04 +0800
committerRunxi Yu <me@runxiyu.org>2025-04-05 20:52:04 +0800
commitb4b0d966340ad9c892f8b8912eebc6118eed7482 (patch)
tree0512a6dd5cfc21fbd91a07d31f972aa2a1cf844d /git_hooks_deploy.go
parentgit2c: git2c.go -> client.go, a more sensible name (diff)
downloadforge-b4b0d966340ad9c892f8b8912eebc6118eed7482.tar.gz
forge-b4b0d966340ad9c892f8b8912eebc6118eed7482.tar.zst
forge-b4b0d966340ad9c892f8b8912eebc6118eed7482.zip
Use cmd/forge for the entry point
Diffstat (limited to 'git_hooks_deploy.go')
-rw-r--r--git_hooks_deploy.go10
1 files changed, 5 insertions, 5 deletions
diff --git a/git_hooks_deploy.go b/git_hooks_deploy.go
index 0cfb4f9..eeda995 100644
--- a/git_hooks_deploy.go
+++ b/git_hooks_deploy.go
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu <https://runxiyu.org>
-package main
+package forge
import (
"errors"
@@ -14,7 +14,7 @@ import (
// deployHooks deploys the git hooks client to the filesystem. The git hooks
// client is expected to be embedded in resourcesFS and must be pre-compiled
// during the build process; see the Makefile.
-func (s *server) deployHooks() (err error) {
+func (s *Server) deployHooks() (err error) {
err = func() (err error) {
var srcFD fs.File
var dstFD *os.File
@@ -24,7 +24,7 @@ func (s *server) deployHooks() (err error) {
}
defer srcFD.Close()
- if dstFD, err = os.OpenFile(filepath.Join(s.config.Hooks.Execs, "hookc"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755); err != nil {
+ if dstFD, err = os.OpenFile(filepath.Join(s.Config.Hooks.Execs, "hookc"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o755); err != nil {
return err
}
defer dstFD.Close()
@@ -41,14 +41,14 @@ func (s *server) deployHooks() (err error) {
// Go's embed filesystems do not store permissions; but in any case,
// they would need to be 0o755:
- if err = os.Chmod(filepath.Join(s.config.Hooks.Execs, "hookc"), 0o755); err != nil {
+ if err = os.Chmod(filepath.Join(s.Config.Hooks.Execs, "hookc"), 0o755); err != nil {
return err
}
for _, hookName := range []string{
"pre-receive",
} {
- if err = os.Symlink(filepath.Join(s.config.Hooks.Execs, "hookc"), filepath.Join(s.config.Hooks.Execs, hookName)); err != nil {
+ if err = os.Symlink(filepath.Join(s.Config.Hooks.Execs, "hookc"), filepath.Join(s.Config.Hooks.Execs, hookName)); err != nil {
if !errors.Is(err, fs.ErrExist) {
return err
}