the repository which powers this website
-rw-r--r--themed/base.html17
-rw-r--r--themed/commit.html15
-rw-r--r--themed/log.html7
-rw-r--r--themed/summary.html11
4 files changed, 33 insertions, 17 deletions
diff --git a/themed/base.html b/themed/base.html
index e3b6bcd3..4b8a79dc 100644
--- a/themed/base.html
+++ b/themed/base.html
@@ -1,4 +1,4 @@
-{! static int get_num_commits(); static int get_num_branches(); static int get_num_tags(); !}
+{! static int get_num_commits(); static int get_num_branches(); static int get_num_tags(); static void short_commit_id(char *hex); !}
{% block page_start %}
<!DOCTYPE html>
@@ -30,7 +30,13 @@
<a href="{! cgit_shared_repolink_url("refs", ctx.qry.head, NULL); !}" class="flex gap-x-1.5 py-1.5 px-3 bg-gray-50 border border-gray-300 rounded-md hover:bg-gray-100">
{# Heroicons micro list-bullet #}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4 self-center text-gray-500"><path d="M3 4.75a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM6.25 3a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 7.25a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM6.25 11.5a.75.75 0 0 0 0 1.5h7a.75.75 0 0 0 0-1.5h-7ZM4 12.25a1 1 0 1 1-2 0 1 1 0 0 1 2 0ZM3 9a1 1 0 1 0 0-2 1 1 0 0 0 0 2Z" /></svg>
- <span class="font-semibold self-baseline">{{ ctx.qry.head }}</span>
+ <span class="font-semibold self-baseline">
+ {% if strcmp(ctx.qry.page, "tree") == 0 && ctx.qry.oid %}
+ {! short_commit_id(ctx.qry.oid); !}
+ {% else %}
+ {{ ctx.qry.head }}
+ {% endif %}
+ </span>
{# Heroicons micro chevron-down #}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" fill="currentColor" class="size-4 self-center text-gray-500"><path fill-rule="evenodd" d="M4.22 6.22a.75.75 0 0 1 1.06 0L8 8.94l2.72-2.72a.75.75 0 1 1 1.06 1.06l-3.25 3.25a.75.75 0 0 1-1.06 0L4.22 7.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" /></svg>
</a>
@@ -184,6 +190,13 @@
cgit_free_reflist_inner(&list);
return num_tags;
}
+
+ static void short_commit_id(char *hex) {
+ char short_commit_id[8];
+ memcpy(short_commit_id, hex, 7);
+ short_commit_id[7] = '\0';
+ html_txt(short_commit_id);
+ }
!}
{!
diff --git a/themed/commit.html b/themed/commit.html
index a3da15e3..90795584 100644
--- a/themed/commit.html
+++ b/themed/commit.html
@@ -39,19 +39,20 @@
<span class="font-gray-500 text-sm">{! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago</span>
<div class="flex-1"></div>
<span class="font-gray-500 text-sm">
- {! char short_commit_id[8]; !}
{% for struct commit_list *p = commit->parents; p; p = p->next %}
{! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !}
{% if parent %}
- {! memcpy(short_commit_id, oid_to_hex(&p->item->object.oid), 7); !}
- {! short_commit_id[7] = '\0'; !}
- parent <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&p->item->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }}</a>
+ parent
+ <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&p->item->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">
+ {! short_commit_id(oid_to_hex(&p->item->object.oid)); !}
+ </a>
&middot;
{% endif %}
{% endfor %}
- {! memcpy(short_commit_id, oid_to_hex(&commit->object.oid), 7); !}
- {! short_commit_id[7] = '\0'; !}
- commit <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }}</a>
+ commit
+ <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">
+ {! short_commit_id(oid_to_hex(&commit->object.oid)); !}
+ </a>
</span>
</div>
</div>
diff --git a/themed/log.html b/themed/log.html
index 4a26a53e..deac76ca 100644
--- a/themed/log.html
+++ b/themed/log.html
@@ -36,10 +36,9 @@
</div>
</div>
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
- {! char short_commit_id[8]; !}
- {! memcpy(short_commit_id, oid_to_hex(&commit->object.oid), 7); !}
- {! short_commit_id[7] = '\0'; !}
- <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="text-sm font-mono text-gray-500 hover:text-blue-600 hover:underline">{{ short_commit_id }}</a>
+ <a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="text-sm font-mono text-gray-500 hover:text-blue-600 hover:underline">
+ {! short_commit_id(oid_to_hex(&commit->object.oid)); !}
+ </a>
</div>
<div class="px-3 py-2 border-t border-gray-300 flex items-center">
<a href="{! cgit_shared_repolink_url_with_delimiter("tree", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="text-gray-500 hover:text-blue-600">
diff --git a/themed/summary.html b/themed/summary.html
index 9bd3004c..b4caf1e9 100644
--- a/themed/summary.html
+++ b/themed/summary.html
@@ -52,10 +52,13 @@
<span class="font-semibold">{{ info->author }}</span>
<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }}</a>
<div class="flex-1"></div>
- {! char short_commit_id[8]; !}
- {! memcpy(short_commit_id, oid_to_hex(&commit->object.oid), 7); !}
- {! short_commit_id[7] = '\0'; !}
- <span class="text-gray-500"><a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="font-mono hover:text-blue-600 hover:underline">{{ short_commit_id }}</a> &middot; {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago</span>
+ <span class="text-gray-500">
+<a href="{! cgit_shared_repolink_url_with_delimiter("commit", ctx.qry.head, ctx.qry.vpath); !}id={{ oid_to_hex(&commit->object.oid) }}" class="font-mono hover:text-blue-600 hover:underline">
+ {! short_commit_id(oid_to_hex(&commit->object.oid)); !}
+</a>
+&middot;
+{! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
+</span>
</div>
{# Files #}
{!