From 3c8913bbc676603072b03d568438e5bbafbc83b4 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Fri, 16 Oct 2026 06:09:53 -1000 Subject: Gate a readme ending in a colon like a disk path trust-scan-config passed any readme holding a colon as a tracked file, while the parser takes one only when a path follows the colon, so a scanned repository could still name a file on disk outside itself. The two now share one test. --- source/cgit.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'source/cgit.c') diff --git a/source/cgit.c b/source/cgit.c index 633b011..82c496e 100644 --- a/source/cgit.c +++ b/source/cgit.c @@ -1035,10 +1035,8 @@ static void parse_readme(const char *readme, char **filename, char **ref, struct if (!readme || !readme[0]) return; - // A colon separates a ref from a path, so a setting carrying one names - // a file tracked in the repository rather than one on disk. - colon = strchr(readme, ':'); - if (colon && strlen(colon) > 1) { + if (cgit_readme_is_tracked(readme)) { + colon = strchr(readme, ':'); if (colon == readme && ctx.qry.head) *ref = xstrdup(ctx.qry.head); else if (colon == readme && repo->defbranch) -- cgit