aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/model.go
diff options
context:
space:
mode:
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) {