261024.13 · 7e0d1de832efc82df65d784e5a1f0113eaf03bfd
Browse a git tree as it was in any commit
Below a tree's address, @ and a commit's hash serve the whole tree as of that commit: docs, code, listings and search, read from git instead of the disk. The version is a path segment, not a query, so relative links in old docs and listings stay in the same version.
Each history entry links its version as browse. A version page names its commit, its age and subject, and links to the page as it is now. Versions never change: no live reload, stop button or copy path, and their listings and files are cached.
reading declarations
Changes to backlinks.go. All files
@@ -44,7 +44,12 @@ type backlinks struct { func (t *tree) serveBacklinks(w http.ResponseWriter, r *http.Request, name string) { ctx, cancel := context.WithTimeout(r.Context(), searchBudget) defer cancel()- res := t.backlinks(ctx, name)+ // A version has no link index, and walking a commit to build one runs+ // git for every directory, so its docs list no backlinks.+ res := backlinks{Links: []hit{}}+ if t.at == nil {+ res = t.backlinks(ctx, name)+ } w.Header().Set("Content-Type", "application/json") w.Header().Set("Cache-Control", "no-store") json.NewEncoder(w).Encode(res)