cgit.git, branch master A hyperfast web frontend for git repositories written in C https://rebizzz.github.io/git-on-github/cgit.git/atom 2026-09-18T11:51:15+00:00 ui-shared: fix the Expires header on error pages 2026-09-18T11:51:15+00:00 Konstantin Ryabitsev konstantin@linuxfoundation.org 2026-08-25T15:07:25+00:00 urn:sha1:156e859aad4c98a169ce4c49e839cae41a28f432 page.expires is an absolute time: the normal path seeds it from page.modified and adds the relevant TTL in seconds. The error page instead assigns cache-dynamic-ttl directly, which is a count of minutes and carries no base, so every error page cgit has produced since "ui-shared: cache errors for dynamic TTL" reports Expires: Thu, 01 Jan 1970 00:00:05 GMT five seconds past the epoch, which is the value of the default TTL read as seconds. The intent of that change was to stop errors being cached forever; the effect is that they are never cached at all, since every downstream cache is told the response was already stale. Seed the value from page.modified and scale the TTL to seconds, matching what calc_ttl() does for ordinary pages. prepare_context() sets page.modified before anything can produce an error page, so the base is always available. Add a test. The header can be checked without any date arithmetic: a TTL of zero has to reproduce Last-Modified exactly, and a non-zero one has to differ from it without falling back to the epoch. Fixes: c5975ae ("ui-shared: cache errors for "dynamic TTL"") Signed-off-by: Konstantin Ryabitsev <konstantin@linuxfoundation.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> html: use buffered stdio 2026-09-18T11:48:51+00:00 Eric Wong e@80x24.org 2026-05-21T13:11:10+00:00 urn:sha1:599e3df55ff0ce7387172c16cba269d545019ed3 Our generation of HTML triggers many small write(2) syscalls which is inefficient. Time output on a horrible query against my git.git mirror shows significant performance improvement: QUERY_STRING='id=2b93bfac0f5bcabbf60f174f4e7bfa9e318e64d5&id2=d6da71a9d16b8cf27f9d8f90692d3625c849cbc8' PATH_INFO=/mirrors/git.git/diff export QUERY_STRING PATH_INFO time ./cgit >/dev/null Before: real 0m1.585s user 0m0.904s sys 0m0.658s After: real 0m0.750s user 0m0.666s sys 0m0.076s Signed-off-by: Eric Wong <e@80x24.org> Signed-off-by: Alyssa Ross <hi@alyssa.is> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> cgit: Fix guessing default branch 2026-09-18T11:46:59+00:00 Baptiste Jonglez git@bitsofnetworks.org 2026-02-27T15:51:11+00:00 urn:sha1:bd308735b3cfd40a57b20723a6e6862bf8303dc0 Even when HEAD is set to "main" in a repository, cgit still uses the "master" branch to detect the age of the last commit. Example: $ cat repositories/openwrt/openwrt.git/HEAD ref: refs/heads/main $ stat repositories/openwrt/openwrt.git/refs/heads/master Modify: 2024-02-22 23:00:01.285731731 +0000 $ stat repositories/openwrt/openwrt.git/refs/heads/main Modify: 2026-02-27 15:33:49.506017172 +0000 In this situation, cgit displays "25 months" for this repository on the index page. I guess the internal format for HEAD has changed at some point, so it needs to be taken into account when parsing it in cgit. Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> css: Support for dark mode 2026-09-18T10:18:33+00:00 Samuel Lidén Borell samuel@kodafritt.se 2023-01-29T16:55:29+00:00 urn:sha1:2e40a36b56f26593fe8fab4f07ed831395d5f0d2 Modern browsers have a "dark mode" preference, which enables alternate styles on web sites that support this. This patch adds a dark color scheme, that is automatically activated via a CSS @media query. Older browsers that do not support color schemes will simply show the light scheme, but possibly without syntax highlighting. Note that filters that use color (such as source highlighters) and logotypes may need to be updated to work with a black background! See the updated files in the filters/ directory. Signed-off-by: Samuel Lidén Borell <samuel@kodafritt.se> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Bump version 2026-05-04T21:03:51+00:00 Jason A. Donenfeld Jason@zx2c4.com 2026-05-04T16:59:41+00:00 urn:sha1:044821677c774cd24f25f1818ea51d09cc64b006 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> global: fix libc constness warnings 2026-05-04T21:03:51+00:00 Jason A. Donenfeld Jason@zx2c4.com 2026-05-04T21:03:22+00:00 urn:sha1:5a0f900569f421422bd7511a45c7346c7668e710 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> git: update to v2.54.0 2026-05-04T17:01:20+00:00 Christian Hesse mail@eworm.de 2026-04-13T06:18:52+00:00 urn:sha1:44ca1d1ec8eee7f4440fbfd613fc1072a14b441c Update to git version v2.54.0, this requires changes for these upstream commits: * d9ecf268ef3f69130fa269012318470d908978f6 odb: embed base source in the "files" backend * cb506a8a69c953f7b87bb3ae099e0bed8218d3ab odb: introduce "files" source ... and probably more related. Signed-off-by: Christian Hesse <mail@eworm.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> cgit: truncate all config values at the newline 2026-05-04T16:28:27+00:00 Jason A. Donenfeld Jason@zx2c4.com 2026-05-04T16:13:13+00:00 urn:sha1:ed05b1054df10a2fbc68000cfdd429daec03a456 These would be largely invalid anyway (save, I suppose, for Linux file paths that technically can contain new lines). The actual problem is that these get printed back out into cached -- and trusted -- cgitrc files, and if the fields have newlines, the git-config way of less trusted users configuring repos on a shared system can be abused to inject newlines, which then can be used to smuggle global options (including filters, which execute code) into the cached cgitrc. So now, only ever duplicate up to the newline, when dealing with these inputs. Reported-by: Adrian Denkiewicz <adrian@doyensec.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> cgit: use strchrnul instead of open coding 2026-05-04T16:28:27+00:00 Jason A. Donenfeld Jason@zx2c4.com 2026-05-04T16:02:57+00:00 urn:sha1:e7e8cf1801b06a9f7f5092671b0413689a765fe7 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> cgit: devirtualize repo_config 2026-05-04T16:28:27+00:00 Jason A. Donenfeld Jason@zx2c4.com 2026-05-04T15:50:43+00:00 urn:sha1:5b4e73c203f5f4484d66f043f1e9114daefeb632 There's no reason to pass around function pointers. It was never used for anything beyond one function. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>