From 10e5cfbe13138edcb1f2b6fc08c0f744d3decbcf Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 13:17:38 -0700 Subject: Mark the static pages in the command table The table already records what each page needs, and a second list of page names in cgit.c had to be kept in step with it by hand. --- source/cgit.c | 30 ++---------------------------- 1 file changed, 2 insertions(+), 28 deletions(-) (limited to 'source/cgit.c') diff --git a/source/cgit.c b/source/cgit.c index 715db59..3788d8a 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -885,33 +885,6 @@ static int is_full_oid(const char *rev) return 1; } -/* - * Only these pages render the same bytes for the same id for ever. A log or - * refs page named with an id still lists branches and tags, which move. - */ -static int page_is_static(void) -{ - static const char *const pages[] = { - "blame", - "blob", - "commit", - "diff", - "patch", - "plain", - "rawdiff", - "snapshot", - "tag", - "tree", - }; - size_t i; - - for (i = 0; i < ARRAY_SIZE(pages); i++) { - if (!strcmp(ctx.qry.page, pages[i])) - return 1; - } - return 0; -} - /* * Every cache-*-ttl setting is written in minutes, and so is this. */ @@ -939,7 +912,8 @@ static int calc_ttl(void) // page to rebuild. if ( ctx.qry.has_oid && - page_is_static() && + cmd && + cmd->is_static && (!ctx.qry.oid || is_full_oid(ctx.qry.oid)) && (!ctx.qry.oid2 || is_full_oid(ctx.qry.oid2)) ) -- cgit