aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/model.go
diff options
context:
space:
mode:
authorMax Resnick <max@ofmax.li>2023-01-29 07:16:25 -0800
committerMax Resnick <max@ofmax.li>2023-01-29 07:16:25 -0800
commit45a8dfd3ba345eebe268fc92d31612e14907fb01 (patch)
treea6a0eff5eaec8f252da23477d73d742d8a867ada /internal/admin/model.go
parent0ac7b93645b169c55f9c50423fab9d4a402e9918 (diff)
downloadgo-git-server-45a8dfd3ba345eebe268fc92d31612e14907fb01.tar.gz
Fixes tests, use correct config file name
Diffstat (limited to '')
-rw-r--r--internal/admin/model.go13
1 files changed, 10 insertions, 3 deletions
diff --git a/internal/admin/model.go b/internal/admin/model.go
index 1b3da00..d9eea03 100644
--- a/internal/admin/model.go
+++ b/internal/admin/model.go
@@ -10,9 +10,13 @@ import (
"os"
"path/filepath"
- "gopkg.in/yaml.v2"
+ "github.com/go-git/go-billy/v5/osfs"
+ "github.com/go-git/go-git/v5"
+ "github.com/go-git/go-git/v5/storage/filesystem"
"gopkg.in/ini.v1"
+
+ "sigs.k8s.io/yaml"
)
const (
@@ -137,6 +141,9 @@ func (r *GitRepo) ReconcileRepo(basePath string) {
_, err := os.Stat(repoBase)
if errors.Is(err, fs.ErrNotExist) {
// if no exist -> init bare
+ fs := osfs.New(repoBase)
+ strg := filesystem.NewStorage(fs, nil)
+ _, _ = git.Init(strg, nil)
}
r.ConfigureExport(repoBase)
@@ -171,10 +178,10 @@ func (r *GitRepo) ConfigureExport(repoBase string) {
// ReconcileGitConf reconcile gitweb configuration section of gitconfig
func (r *GitWeb) ReconcileGitConf(repoBase string) {
- confPath := filepath.Join(repoBase, "conf")
+ confPath := filepath.Join(repoBase, "config")
cfg, err := ini.Load(confPath)
if err != nil {
- log.Fatal("Coudln't read gitconfig")
+ log.Fatalf("Coudln't read gitconfig %s", err)
}
// check if empty, delete
if (GitWeb{} == *r) {