Fix branch/commit view bugs

- Filter out non-branch refs (like HEAD) from branch list
- Walk all branch tips in commit list so older checkouts still
  show newer commits
- Show '(current)' instead of Checkout button for HEAD commit
- Swap nav link order in blob view (commits first, then tree)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-02-27 09:52:59 +01:00
parent fdc520cfaf
commit fbfffac73f
4 changed files with 24 additions and 7 deletions
+2 -2
View File
@@ -7,9 +7,9 @@
<h2 th:text="${filePath}">file.txt</h2>
<p>
<a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash})}">&lt; Back to tree</a>
|
<a th:href="@{/repo/{name}/commits(name=${name})}">&lt; Back to commits</a>
|
<a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${hash})}">&lt; Back to tree</a>
</p>
<table border="0" cellpadding="4" cellspacing="0">
+2 -1
View File
@@ -25,7 +25,8 @@
<td th:text="${c.date}"></td>
<td><a th:href="@{/repo/{name}/tree/{hash}(name=${name}, hash=${c.hash})}">Browse</a></td>
<td>
<form method="post" th:action="@{/repo/{name}/checkout-commit(name=${name})}">
<span th:if="${c.hash == headHash}">(current)</span>
<form th:unless="${c.hash == headHash}" method="post" th:action="@{/repo/{name}/checkout-commit(name=${name})}">
<input type="hidden" name="hash" th:value="${c.hash}">
<input type="submit" value="Checkout">
</form>