parent:
585be7e7e1255e44cef779b4eeab47ee22ff35f7
nmyk <nick@nmyk.io>
2026-02-16T12:35:43-05:00
cosmetic fixes
diff --git a/main.go b/main.go
index 964d71f48ad6a6c9be499a03a3ae68dd94670ebb..6cf63e81a53a786e3527b000f6f56a583f722ed5 100644
--- a/main.go
+++ b/main.go
@@ -39,8 +39,8 @@ mux.HandleFunc("GET /", listRepos)
mux.HandleFunc("GET /{name}", repoIndex)
mux.HandleFunc("GET /{name}/refs", refs)
mux.HandleFunc("GET /{name}/tree/{ref}", repoTree)
- mux.HandleFunc("GET /{name}/tree/{ref}/{rest...}", repoTree)
- mux.HandleFunc("GET /{name}/blob/{ref}/{rest...}", blob)
+ mux.HandleFunc("GET /{name}/tree/{ref}/{path...}", repoTree)
+ mux.HandleFunc("GET /{name}/blob/{ref}/{path...}", blob)
return mux
}
@@ -162,7 +162,7 @@ if err != nil {
http.Error(w, err.Error(), 500)
return
}
- filePath := r.PathValue("rest")
+ filePath := r.PathValue("path")
entry, err := tree.FindEntry(filePath)
if err != nil {
http.NotFound(w, nil)
@@ -222,7 +222,7 @@ if err != nil {
http.Error(w, "Cannot resolve HEAD state", 500)
}
headRef := head.Name().Short()
- treePath := r.PathValue("rest")
+ treePath := r.PathValue("path")
if refName == headRef && treePath == "" {
repoIndex(w, r)
return
diff --git a/templates/blob.tmpl b/templates/blob.tmpl
index 806e5090049ed586a8dcbc7432a93a06b400f6ef..f0be0b16f928f0d16c7948dfee3ff5ed99ea57a9 100644
--- a/templates/blob.tmpl
+++ b/templates/blob.tmpl
@@ -9,6 +9,8 @@ {{else}}
<a href="/{{$c.URL}}">{{$c.Name}}</a>
{{end}}
{{end}}</h1>
+<p>@ {{.Ref}}</p>
+<hr>
<pre>{{.Content}}</pre>
{{end}}
diff --git a/templates/tree.tmpl b/templates/tree.tmpl
index 74bf3fd312b0bb754d610f28df06fcdcbbdb6640..5fe3a1e58c1e37b641596e5505c590cca74cc3c3 100644
--- a/templates/tree.tmpl
+++ b/templates/tree.tmpl
@@ -2,7 +2,7 @@ {{define "title"}}{{.Repo}}/{{.Base}}{{end}}
{{define "content"}}
<h1>{{if ne .Base ""}}<a href="/{{.Repo}}/tree/{{.Ref}}">{{.Repo}}</a> /
{{else}}
-<a href="/{{.Repo}}/tree/{{.HeadRef}}">{{.Repo}}</a> /
+<a href="/{{.Repo}}/tree/{{.HeadRef}}">{{.Repo}}</a>
{{end}}
{{range $i, $c := .Crumbs}}
{{if $i}} / {{end}}