git-preview @ main

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

git: rework diff to fetch initial commit
Sun, 18 Dec 2022
3 files changed, 70 insertions(+), 17 deletions(-)
M git/diff.go

@@ -44,19 +44,28 @@ if err != nil {

return nil, fmt.Errorf("commit object: %w", err) } - var parent *object.Commit - if len(c.ParentHashes) > 0 { - parent, err = c.Parent(0) - if err != nil { - return nil, fmt.Errorf("getting parent: %w", err) + patch := &object.Patch{} + commitTree, err := c.Tree()

… preview truncated

M routes/routes.go

@@ -106,8 +106,8 @@

tpath := filepath.Join(d.c.Dirs.Templates, "*") t := template.Must(template.ParseGlob(tpath)) - if len(commits) >= 5 { - commits = commits[:5] + if len(commits) >= 3 { + commits = commits[:3] } data := make(map[string]any)

… preview truncated

M static/style.css

@@ -147,7 +147,9 @@ white-space: pre-wrap;

} .diff { - padding-top: 1rem; + margin: 1rem 0 1rem 0; + padding: 1rem 0 1rem 0; + border-bottom: 1.5px solid var(--medium-gray); } .diff pre {

… preview truncated