the repository which powers this website
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{! #include "../ui-diff.h" !}

{% page cgit_print_commit %}
{!
	char *hex = ctx.qry.oid;
	if (!hex) { hex = ctx.qry.head; }
	
	struct object_id oid;
	if (repo_get_oid(the_repository, hex, &oid)) {
		die("Bad object id");
	}
	struct commit *commit = lookup_commit_reference(the_repository, &oid);
	if (!commit) {
		die("Bad commit reference");
	}
	struct commitinfo *info = cgit_parse_commit(commit);
	
	ctx.page.title = fmtalloc("%s - %s", info->subject, ctx.page.title);
!}
{! page_start(ctx.repo->name, fmtalloc("look at commit \"%s\"", info->subject)); !}
{! repo_header(); !}
		<main class="max-w-7xl mx-auto py-4 pl-2 pr-2">{# Main content #}
{! repo_description_panel(); !}
{! repo_summary_bar(); !}
			<div class="grid grid-cols-1 border border-[#333A45] rounded-md divide-y divide-[#333A45] mb-4">
				{# Commit info box #}
				<div class="px-3 py-2 flex items-top">
					<div class="flex-1">
						{# Description panel #}
						<div class="text-lg font-semibold">{{ info->subject }}</div>
						{% if info-> msg %}
						<div class="text-[#a3a29c] pt-1">{{ info->msg }}</div>
						{% endif %}
					</div>
					<div class="py-2">
						<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="p-2 text-sm text-[#1F2430] bg-[#73D0FF] rounded-md hover:bg-[#4CB3FF]">Browse Source</a>
					</div>
				</div>
				<div class="px-3 py-2 rounded-b-md bg-[#262F3F] flex gap-x-1 items-center">
					<img class="gravatar" src="{! gravatar_url(info->author_email); !}?s=24">
					<span class="font-semibold text-sm">{{ info->author }}</span>
					<span class="text-[#a3a29c] text-sm">{! cgit_print_age_themed(info->committer_date, info->committer_tz, TM_MONTH * 12); !}</span>
					<div class="flex-1"></div>
					<span class="text-[#a3a29c] text-sm">
						{% 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 %}
						parent
						<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&p->item->object.oid), ctx.qry.vpath); !}" class="font-mono text-[#73D0FF] hover:text-[#4CB3FF] hover:underline">{! short_commit_id(oid_to_hex(&p->item->object.oid)); !}</a>
						&middot;
						{% endif %}
						{% endfor %}
						commit
						<a href="{! cgit_shared_reporevlink_url("commit", ctx.qry.head, oid_to_hex(&commit->object.oid), ctx.qry.vpath); !}" class="font-mono text-[#73D0FF] hover:text-[#4CB3FF] hover:underline">{! short_commit_id(oid_to_hex(&commit->object.oid)); !}</a>
					</span>
				</div>
			</div>
			<div class="diff-panel overflow-x-auto">
				{# Diff panel #}
				{! cgit_print_diff(ctx.qry.oid, NULL, NULL, 0, 0); !}
			</div>
		</main>
{! cgit_free_commitinfo(info); !}
{! page_end(); !}
{% endpage %}