diff --git a/themed/base.html b/themed/base.html index e3b6bcd..4b8a79d 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 %} @@ -30,7 +30,13 @@ {# Heroicons micro list-bullet #} - {{ ctx.qry.head }} + + {% if strcmp(ctx.qry.page, "tree") == 0 && ctx.qry.oid %} + {! short_commit_id(ctx.qry.oid); !} + {% else %} + {{ ctx.qry.head }} + {% endif %} + {# Heroicons micro chevron-down #} @@ -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 a3da15e..9079558 100644 --- a/themed/commit.html +++ b/themed/commit.html @@ -39,19 +39,20 @@ {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
- {! 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 item->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }} + parent + 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)); !} + · {% endif %} {% endfor %} - {! memcpy(short_commit_id, oid_to_hex(&commit->object.oid), 7); !} - {! short_commit_id[7] = '\0'; !} - commit object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline">{{ short_commit_id }} + commit + object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline"> + {! short_commit_id(oid_to_hex(&commit->object.oid)); !} + diff --git a/themed/log.html b/themed/log.html index 4a26a53..deac76c 100644 --- a/themed/log.html +++ b/themed/log.html @@ -36,10 +36,9 @@