aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRunxi Yu <me@runxiyu.org>2025-03-29 22:06:10 +0800
committerRunxi Yu <me@runxiyu.org>2025-03-29 22:06:10 +0800
commit395e3ec3ce663254bf97fe9900760cf051bd1ed9 (patch)
treefb6f00b121b0106622ff292ed31ebc082e4ae9aa
parentMake git_hooks_handle portable ish? (diff)
downloadforge-395e3ec3ce663254bf97fe9900760cf051bd1ed9.tar.gz
forge-395e3ec3ce663254bf97fe9900760cf051bd1ed9.tar.zst
forge-395e3ec3ce663254bf97fe9900760cf051bd1ed9.zip
Don't error out because the symlink exists
-rw-r--r--git_hooks_deploy.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/git_hooks_deploy.go b/git_hooks_deploy.go
index 86df6e3..5952c83 100644
--- a/git_hooks_deploy.go
+++ b/git_hooks_deploy.go
@@ -4,6 +4,7 @@
package main
import (
+ "errors"
"io"
"io/fs"
"os"
@@ -48,7 +49,10 @@ func deployHooks() (err error) {
"pre-receive",
} {
if err = os.Symlink(filepath.Join(config.Hooks.Execs, "hookc"), filepath.Join(config.Hooks.Execs, hookName)); err != nil {
- return err
+ if !errors.Is(err, fs.ErrExist) {
+ return err
+ }
+ // TODO: Maybe check if it points to the right place?
}
}