AuraRepo > Commit [9ee9a96]

Christian Lee Seibold

Thu February 20, 2025 8:23 AM -0600

Show documentation link if there's a docs directory.


 git.go | 21 ++++++++++++++++++++-

Commit Hash: 9ee9a96c55bbef2507d0aa3f6b0b6e15b4b6bdf3

Tree Hash: ae98d6dc5c77e5612ebb50fb30c43f1a79990c6d

Date: 2025-02-20T08:23:36-06:00

PGP Signature: -----BEGIN PGP SIGNATURE-----

iHUEABYKAB0WIQSghH500ekD7Pc/Zj6PbjnL2ZXQ4AUCZ7c66AAKCRCPbjnL2ZXQ

4PHDAP9DGQQGPA1dOmdMl52p3rvn7L2jqt0HrZwLgFoLeRQ+tgD/cz92Jzs6nMaI

8K4yQ5+/P12OEreSQN3d05DzZJO1hQo=

=KnUf

-----END PGP SIGNATURE-----

Browse Tree
Parent e23ad56
Commits
Repo Home

Changes

git.go

   ... | ...
   157 | 	request.Link("/tags/", "🔖 Tags")
   158 | 	request.Link(fmt.Sprintf("/tree/%s", bref.Name().Short()), "🗎 File Tree")
   159 | 	request.Link("/branches/", "⌥ Branches")
   160 | 	request.Link("/notes/", "📝 Notespaces")
   161 | 
-  162 | 	// If there is a "docs" or "documentation" branch, then show it here.
+  162 | 	// If there is a "docs" or "documentation" branch (or subtree), then show it here.
   163 | 	if docsref != nil {
   164 | 		request.Link(fmt.Sprintf("/tree/%s", docsref.Name().Short()), "Documentation")
   ... | ...
   160 | 	if docsref != nil {
   161 | 		request.Link(fmt.Sprintf("/tree/%s", docsref.Name().Short()), "Documentation")
+  165 | 	} else {
+  166 | 		docsTree, _ := tree.Tree("docs")
+  167 | 		if docsTree == nil {
+  168 | 			docsTree, _ = tree.Tree("documentation")
+  169 | 		}
+  170 | 		if docsTree != nil {
+  171 | 			request.Link(fmt.Sprintf("/tree/%s", docsTree.Hash.String()), "Documentation")
+  172 | 		}
   165 | 	}
   166 | 
   167 | 	request.Gemini("\n")
   168 | 
   169 | 	// Show the five Latest Commits
   ... | ...
   637 | 			return
   638 | 		}
   639 | 	}
   640 | 
   641 | 	// TODO: Add support for a regular tree object hash.
+  650 | 	tree, _ := repo.TreeObject(plumbing.NewHash(name))
+  651 | 	if tree != nil {
+  652 | 		//tree.Tree(path string)
+  653 | 		repo.handleTreeObjectTreeHeader(request, tree)
+  654 | 		repo.handleTreeListing(request, tree)
+  655 | 		return
+  656 | 	}
   642 | 
   643 | 	// Error out if none of the above worked.
   644 | 	request.TemporaryFailure("Could not parse name/hash.")
   645 | }
   646 | 
   ... | ...
   740 | }
   741 | 
   742 | // Annotated Tags
   743 | func (repo *Repo) handleTagObjectTreeHeader(request *sis.Request, atag *object.Tag) {
   744 | 	request.Gemini(fmt.Sprintf("# %s > Tree [%s]\n", repo.Title, atag.Name))
+  760 | }
+  761 | 
+  762 | func (repo *Repo) handleTreeObjectTreeHeader(request *sis.Request, tree *object.Tree) {
+  763 | 	request.Gemini(fmt.Sprintf("# %s > Subtree [%s]\n", repo.Title, tree.Hash.String()))
   745 | }
   746 | 
   747 | // The actual file list
   748 | func (repo *Repo) handleTreeListing(request *sis.Request, root_tree *object.Tree) {
   749 | 	request.Gemini(fmt.Sprintf("/%s\n\n", request.GlobString)) // Current Path