diff options
author | Runxi Yu <me@runxiyu.org> | 2025-03-05 08:51:17 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-03-05 08:51:17 +0800 |
commit | 7c341685f878aa8fd4c49788cf8cc0d8c5c6e127 (patch) | |
tree | 5295f1f4020e85c065e98fcb88ec217ad66e078a /git_init.go | |
parent | config: Add explanatory comments (diff) | |
download | forge-7c341685f878aa8fd4c49788cf8cc0d8c5c6e127.tar.gz forge-7c341685f878aa8fd4c49788cf8cc0d8c5c6e127.tar.zst forge-7c341685f878aa8fd4c49788cf8cc0d8c5c6e127.zip |
*: Replace some := with var
Diffstat (limited to '')
-rw-r--r-- | git_init.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/git_init.go b/git_init.go index 2e10633..1e1f8c7 100644 --- a/git_init.go +++ b/git_init.go @@ -5,26 +5,27 @@ package main import ( "github.com/go-git/go-git/v5" + git_config "github.com/go-git/go-git/v5/config" git_format_config "github.com/go-git/go-git/v5/plumbing/format/config" ) // git_bare_init_with_default_hooks initializes a bare git repository with the // forge-deployed hooks directory as the hooksPath. func git_bare_init_with_default_hooks(repo_path string) (err error) { - repo, err := git.PlainInit(repo_path, true) - if err != nil { + var repo *git.Repository + var git_config *git_config.Config + + if repo, err = git.PlainInit(repo_path, true); err != nil { return err } - git_config, err := repo.Config() - if err != nil { + if git_config, err = repo.Config(); err != nil { return err } git_config.Raw.SetOption("core", git_format_config.NoSubsection, "hooksPath", config.Hooks.Execs) - err = repo.SetConfig(git_config) - if err != nil { + if err = repo.SetConfig(git_config); err != nil { return err } |