summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-08-11 08:25:08 -0400
committerJoe Mou <dev@mou.fo>2026-08-11 08:25:43 -0400
commit5526d976f645def4caae9fbd2c1d75349029764e (patch)
tree6f25795f030fbfc7f86086f0c337d7fd82c57cc9
parent9cef0850f8049a8f1cb11097852738de4cad4a30 (diff)
Abbreviate commit hashes in branch picker
-rw-r--r--cgithub/views/_nav.eta6
1 files changed, 5 insertions, 1 deletions
diff --git a/cgithub/views/_nav.eta b/cgithub/views/_nav.eta
index e3fbdcf..eb7ed42 100644
--- a/cgithub/views/_nav.eta
+++ b/cgithub/views/_nav.eta
@@ -1,6 +1,10 @@
<section>
+ <%
+ const isCommitHash = /^[0-9a-f]{40}$/.test(it.branch);
+ const refLabel = isCommitHash ? it.branch.slice(0, 7) : it.branch;
+ %>
<button type="button" class="ref-selector-button branch" command="show-modal" commandfor="ref-selector-menu">
- <img src="/static/icons/git-branch.svg" alt="branch" class="icon"> <%= it.branch %> ▾
+ <img src="/static/icons/git-branch.svg" alt="branch" class="icon"> <%= refLabel %> ▾
</button>
<dialog class="ref-selector-menu" id="ref-selector-menu" closedby="any" data-owner="<%= it.repo.owner %>" data-repo="<%= it.repo.name %>">
<div class="ref-selector-tabs">