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
{% block tree_listing_item(const struct object_id *oid, struct strbuf *base, const char *pathname, unsigned mode, bool border_above) %}
				{# Directory listing entry #}
				{!
					unsigned long size = 0;
					if (!S_ISGITLINK(mode)) {
						oid_object_info(the_repository, oid, &size);
					}
					
					struct strbuf fullpath = STRBUF_INIT;
					strbuf_addf(&fullpath, "%s%s", base->buf, pathname);
				!}
				<div class="pl-3 pr-1 py-2{% if border_above %} border-t border-[#333A45]{% endif %}">
					<img src="/icons/{{ cgit_get_file_icon(pathname, mode) }}.svg" width="30" height="30" />
				</div>
				<div class="font-mono pr-3 py-2{% if border_above %} border-t border-[#333A45]{% endif %}">
					{# File name and link #}
					{% if S_ISGITLINK(mode) %}
						{! cgit_submodule_link("ls-mod", fullpath.buf, pathname, oid_to_hex(oid)); !}
					{% else %}
					<a href="{! cgit_shared_reporevlink_url("tree", ctx.qry.head, ctx.qry.oid, fullpath.buf); !}" class="hover:text-[#73D0FF] hover:underline">
						{{ pathname }}
					</a>
					{% endif %}
				</div>
				<div class="pr-3 py-2{% if border_above %} border-t border-[#333A45]{% endif %} text-[#a3a29c] font-mono">
					{# Mode #}
					{! cgit_print_filemode(mode); !}
				</div>
				<div class="pr-3 py-2{% if border_above %} border-t border-[#333A45]{% endif %} text-[#a3a29c] text-end">
					{# File size #}
					{% if !S_ISGITLINK(mode) && !S_ISDIR(mode) && !S_ISLNK(mode) %}
					{{ size|%ld }}
					{% endif %}
				</div>
				{! strbuf_release(&fullpath); !}
{% endblock %}