From 8a7aa400143f3e95b3ecd18f19e21b526d6a419d Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sat, 31 Oct 2026 19:47:34 -1000 Subject: Read the description file without repo.desc Only a scanned repository fell back to its description file, so one listed in cgitrc without repo.desc showed "[no description]" however its file read. repo.desc may follow repo.path, so the file is read where a page shows the description, which also spares every other request the reads. --- source/scan-tree.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'source/scan-tree.c') diff --git a/source/scan-tree.c b/source/scan-tree.c index 6c1f854..87dd10c 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -9,11 +9,6 @@ #include "scan-tree.h" #include "shared.h" -// Git writes this line into the description file of every repository it -// creates, so a repository still carrying it gets cgit's own default instead. -static const char *default_git_desc = - "Unnamed repository; edit this file 'description' to name the repository."; - // The config callbacks are handed only a name and a value, so the repository // being filled in waits here for the length of one add_repo call. static struct cgit_repo *current_repo; @@ -242,15 +237,7 @@ static void add_repo(const char *base, struct strbuf *path) } } - if (current_repo->desc == cgit_default_repo_desc) { - strbuf_addstr(path, "description"); - cgit_read_first_line(path->buf, ¤t_repo->desc); - strbuf_setlen(path, pathlen); - if (current_repo->desc && !strcmp(current_repo->desc, default_git_desc)) { - free(current_repo->desc); - current_repo->desc = cgit_default_repo_desc; - } - } + cgit_read_repo_desc(current_repo); if (ctx.cfg.section_from_path) set_section_from_path(&relpath, ctx.cfg.section_from_path); -- cgit 2.12.1