git-preview @ main

static git web frontend but with images and html previews + code truncation

git: find main branch from config
Tue, 13 Dec 2022
4 files changed, 37 insertions(+), 17 deletions(-)
M config.yaml

@@ -1,10 +1,13 @@

-git: +repo: scanPath: /home/icy/code/tmp/testrepos readme: - readme - README - readme.md - README.md + mainBranch: + - master

… preview truncated

M config/config.go

@@ -8,10 +8,11 @@ "gopkg.in/yaml.v3"

) type Config struct { - Git struct { - ScanPath string `yaml:"scanPath"` - Readme []string `yaml:"readme"` - } `yaml:"git"` + Repo struct { + ScanPath string `yaml:"scanPath"` + Readme []string `yaml:"readme"`

… preview truncated

M git/git.go

@@ -110,3 +110,13 @@ })

return branches, nil } + +func (g *GitRepo) FindMainBranch(branches []string) (string, error) { + for _, b := range branches { + _, err := g.r.ResolveRevision(plumbing.Revision(b)) + if err == nil { + return b, nil + }

… preview truncated

… and 1 more changed files not shown in this preview