From da1d8f4e7c332c7109427915e6459b10209cedce Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 6 Apr 2025 09:26:46 +0800 Subject: Move the Go stuff to ./forged/ --- internal/unsorted/git_init.go | 34 ---------------------------------- 1 file changed, 34 deletions(-) delete mode 100644 internal/unsorted/git_init.go (limited to 'internal/unsorted/git_init.go') diff --git a/internal/unsorted/git_init.go b/internal/unsorted/git_init.go deleted file mode 100644 index a9bba78..0000000 --- a/internal/unsorted/git_init.go +++ /dev/null @@ -1,34 +0,0 @@ -// SPDX-License-Identifier: AGPL-3.0-only -// SPDX-FileCopyrightText: Copyright (c) 2025 Runxi Yu - -package unsorted - -import ( - "github.com/go-git/go-git/v5" - gitConfig "github.com/go-git/go-git/v5/config" - gitFmtConfig "github.com/go-git/go-git/v5/plumbing/format/config" -) - -// gitInit initializes a bare git repository with the forge-deployed hooks -// directory as the hooksPath. -func (s *Server) gitInit(repoPath string) (err error) { - var repo *git.Repository - var gitConf *gitConfig.Config - - if repo, err = git.PlainInit(repoPath, true); err != nil { - return err - } - - if gitConf, err = repo.Config(); err != nil { - return err - } - - gitConf.Raw.SetOption("core", gitFmtConfig.NoSubsection, "hooksPath", s.config.Hooks.Execs) - gitConf.Raw.SetOption("receive", gitFmtConfig.NoSubsection, "advertisePushOptions", "true") - - if err = repo.SetConfig(gitConf); err != nil { - return err - } - - return nil -} -- cgit v1.2.3