Commit 32c5e95
Eric Bower
·
2025-08-10 09:41:11 -0400 EDT
parent 8573635
fix: ensure readme is in root for summary page
2 files changed,
+12,
-15
| ... | ... | @@ -1,5 +1,5 @@ | |
| 1 | 1 | {{define "footer"}} | |
| 2 | 2 | <div> | |
| 3 | - | built with <a href="https://erock-git-pgit.pgs.sh">pgit</a> and published with <a href="https://pgs.sh">pgs.sh</a> | |
| 3 | + | built with <a href="https://pgit.pico.sh">pgit</a> | |
| 4 | 4 | </div> | |
| 5 | 5 | {{end}} |
M
main.go
+11,
-14
| ... | ... | @@ -25,8 +25,11 @@ import ( | |
| 25 | 25 | git "github.com/gogs/git-module" | |
| 26 | 26 | ) | |
| 27 | 27 | ||
| 28 | - | //go:embed html/*.tmpl static/* | |
| 29 | - | var efs embed.FS | |
| 28 | + | //go:embed html/*.tmpl | |
| 29 | + | var embedFS embed.FS | |
| 30 | + | ||
| 31 | + | //go:embed static/* | |
| 32 | + | var staticFS embed.FS | |
| 30 | 33 | ||
| 31 | 34 | type Config struct { | |
| 32 | 35 | // required params |
| ... | ... | @@ -308,7 +311,7 @@ func readmeFile(repo *Config) string { | |
| 308 | 311 | ||
| 309 | 312 | func (c *Config) writeHtml(writeData *WriteData) { | |
| 310 | 313 | ts, err := template.ParseFS( | |
| 311 | - | efs, | |
| 314 | + | embedFS, | |
| 312 | 315 | writeData.Template, | |
| 313 | 316 | "html/header.partial.tmpl", | |
| 314 | 317 | "html/footer.partial.tmpl", |
| ... | ... | @@ -331,7 +334,7 @@ func (c *Config) writeHtml(writeData *WriteData) { | |
| 331 | 334 | } | |
| 332 | 335 | ||
| 333 | 336 | func (c *Config) copyStatic(dir string) error { | |
| 334 | - | entries, err := efs.ReadDir(dir) | |
| 337 | + | entries, err := staticFS.ReadDir(dir) | |
| 335 | 338 | bail(err) | |
| 336 | 339 | ||
| 337 | 340 | for _, e := range entries { |
| ... | ... | @@ -340,7 +343,7 @@ func (c *Config) copyStatic(dir string) error { | |
| 340 | 343 | continue | |
| 341 | 344 | } | |
| 342 | 345 | ||
| 343 | - | w, err := efs.ReadFile(infp) | |
| 346 | + | w, err := staticFS.ReadFile(infp) | |
| 344 | 347 | bail(err) | |
| 345 | 348 | fp := filepath.Join(c.Outdir, e.Name()) | |
| 346 | 349 | c.Logger.Info("writing", "filepath", fp) |
| ... | ... | @@ -421,7 +424,7 @@ func (c *Config) writeHTMLTreeFile(pageData *PageData, treeItem *TreeItem) strin | |
| 421 | 424 | ||
| 422 | 425 | nameLower := strings.ToLower(treeItem.Entry.Name()) | |
| 423 | 426 | summary := readmeFile(pageData.Repo) | |
| 424 | - | if nameLower == summary { | |
| 427 | + | if d == "." && nameLower == summary { | |
| 425 | 428 | readme = contents | |
| 426 | 429 | } | |
| 427 | 430 |
| ... | ... | @@ -454,13 +457,7 @@ func (c *Config) writeLogDiff(repo *git.Repository, pageData *PageData, commit * | |
| 454 | 457 | c.Mutex.Unlock() | |
| 455 | 458 | } | |
| 456 | 459 | ||
| 457 | - | diff, err := repo.Diff( | |
| 458 | - | commitID, | |
| 459 | - | 0, | |
| 460 | - | 0, | |
| 461 | - | 0, | |
| 462 | - | git.DiffOptions{}, | |
| 463 | - | ) | |
| 460 | + | diff, err := repo.Diff(commitID, 0, 0, 0, git.DiffOptions{}) | |
| 464 | 461 | bail(err) | |
| 465 | 462 | ||
| 466 | 463 | rnd := &DiffRender{ |
| ... | ... | @@ -1022,7 +1019,7 @@ func (c *Config) writeRevision(repo *git.Repository, pageData *PageData, refs [] | |
| 1022 | 1019 | wg.Wait() | |
| 1023 | 1020 | ||
| 1024 | 1021 | c.Logger.Info( | |
| 1025 | - | "compilation complete branch", | |
| 1022 | + | "compilation complete", | |
| 1026 | 1023 | "repoName", c.RepoName, | |
| 1027 | 1024 | "revision", pageData.RevData.Name(), | |
| 1028 | 1025 | ) |