From 8f023f452d594a01c1b910c156b2732b7a627498 Mon Sep 17 00:00:00 2001 From: RunasSudo Date: Thu, 15 May 2025 14:57:45 +1000 Subject: [PATCH] fixup preserve --- themed/commit.html | 6 +++--- themed/log.html | 6 +++--- themed/refs.html | 2 +- themed/summary.html | 10 +++++++--- themed/tree.html | 8 ++++++-- ui-shared.c | 10 ++++++++++ ui-shared.h | 1 + 7 files changed, 31 insertions(+), 12 deletions(-) diff --git a/themed/commit.html b/themed/commit.html index 9079558..9f5ec47 100644 --- a/themed/commit.html +++ b/themed/commit.html @@ -30,7 +30,7 @@

{{ info->subject }}

- object.oid) }}" class="p-2 text-sm text-white bg-blue-500 rounded-md hover:bg-blue-600">Browse Source + object.oid), ctx.qry.vpath); !}" class="p-2 text-sm text-white bg-blue-500 rounded-md hover:bg-blue-600">Browse Source
@@ -43,14 +43,14 @@ {! struct commit *parent = lookup_commit_reference(the_repository, &p->item->object.oid); !} {% if parent %} parent - item->object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline"> + item->object.oid), ctx.qry.vpath); !}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline"> {! short_commit_id(oid_to_hex(&p->item->object.oid)); !} · {% endif %} {% endfor %} commit - object.oid) }}" class="font-mono text-blue-500 hover:text-blue-600 hover:underline"> + object.oid), ctx.qry.vpath); !}" 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 deac76c..245e458 100644 --- a/themed/log.html +++ b/themed/log.html @@ -29,19 +29,19 @@ {% while (commit = get_revision(&rev)) != NULL %} {! struct commitinfo *info = cgit_parse_commit(commit); !}
-
object.oid) }}" class="hover:text-blue-600 hover:underline">{{ info->subject }}
+
object.oid), ctx.qry.vpath); !}" class="hover:text-blue-600 hover:underline">{{ info->subject }}
{{ info->author }} committed {! cgit_print_age(info->committer_date, info->committer_tz, TM_WEEK * 2); !} ago
- object.oid) }}" class="text-gray-500 hover:text-blue-600"> + object.oid), ctx.qry.vpath); !}" class="text-gray-500 hover:text-blue-600"> {# Heroicons mini code-bracket #} diff --git a/themed/refs.html b/themed/refs.html index 0c5e714..80b4e52 100644 --- a/themed/refs.html +++ b/themed/refs.html @@ -43,7 +43,7 @@
{% if strcmp(name, ctx.qry.head) %}{# Only show compare button if not equal to current branch #}
- + Compare {% endif %} diff --git a/themed/summary.html b/themed/summary.html index b4caf1e..14b0727 100644 --- a/themed/summary.html +++ b/themed/summary.html @@ -16,7 +16,11 @@ {% endif %}
-
{{ pathname }}
+
+ + {{ pathname }} + +
{! cgit_print_filemode(mode); !}
{% if !S_ISDIR(mode) %}{{ size|%ld }}{% endif %}
{% endblock %} @@ -50,10 +54,10 @@
{{ info->author }} - object.oid) }}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }} + object.oid), ctx.qry.vpath); !}" class="ml-2 text-gray-500 hover:text-blue-600 hover:underline">{{ info->subject }}
-object.oid) }}" class="font-mono hover:text-blue-600 hover:underline"> + object.oid), ctx.qry.vpath); !}" class="font-mono hover:text-blue-600 hover:underline"> {! short_commit_id(oid_to_hex(&commit->object.oid)); !} · diff --git a/themed/tree.html b/themed/tree.html index 1887625..5ad6a11 100644 --- a/themed/tree.html +++ b/themed/tree.html @@ -4,7 +4,7 @@
{# Breadcrumbs #} {# TODO: Make breadcrumbs hyperlinks #} - {{ ctx.repo->name }} / {{ ctx.qry.path }} + {{ ctx.repo->name }} / {{ ctx.qry.path }}
{% endblock %} @@ -37,7 +37,11 @@ {% endif %}
-
{{ pathname }}
+
+ + {{ pathname }} + +
{! cgit_print_filemode(mode); !}
{% if !S_ISDIR(mode) %}{{ size|%ld }}{% endif %}
{! strbuf_release(&fullpath); !} diff --git a/ui-shared.c b/ui-shared.c index 9d36f86..5e4d83e 100644 --- a/ui-shared.c +++ b/ui-shared.c @@ -381,6 +381,16 @@ static void reporevlink(const char *page, const char *name, const char *title, html(""); } +void cgit_shared_reporevlink_url(const char *page, const char *head, const char *rev, const char *path) +{ + const char *delim = cgit_shared_repolink_url(page, head, path); + if (rev && ctx.qry.head != NULL && strcmp(rev, ctx.qry.head)) { + html(delim); + html("id="); + html_url_arg(rev); + } +} + void cgit_summary_link(const char *name, const char *title, const char *class, const char *head) { diff --git a/ui-shared.h b/ui-shared.h index 6867ce3..47fcced 100644 --- a/ui-shared.h +++ b/ui-shared.h @@ -3,6 +3,7 @@ extern const char *cgit_shared_repolink_url(const char *page, const char *head, const char *path); extern void cgit_shared_repolink_url_with_delimiter(const char *page, const char *head, const char *path); +extern void cgit_shared_reporevlink_url(const char *page, const char *head, const char *rev, const char *path); extern void cgit_shared_site_url(const char *page, const char *search, const char *sort, int ofs, int always_root); extern const char *cgit_httpscheme(void);