From 39b47e8132aedabd4d0342596f3323fbb5c04809 Mon Sep 17 00:00:00 2001 From: Bryce Kwon Date: Sun, 2 Aug 2026 09:38:30 -1000 Subject: Hide git's default repository description --- source/scan-tree.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/scan-tree.c') diff --git a/source/scan-tree.c b/source/scan-tree.c index 82f2cc0..7e626bf 100644 --- a/source/scan-tree.c +++ b/source/scan-tree.c @@ -46,6 +46,9 @@ out: return result; } +// The description git puts in every freshly created repository. +static const char *default_git_desc = "Unnamed repository; edit this file 'description' to name the repository."; + static struct cgit_repo *repo; static void scan_tree_repo_config(const char *name, const char *value) @@ -154,6 +157,13 @@ static void add_repo(const char *base, struct strbuf *path) if (!stat(path->buf, &st)) read_first_line(path->buf, &repo->desc, &size); strbuf_setlen(path, pathlen); + // Git writes this line into every repository it creates, so it + // describes nothing. Treat it as no description at all rather + // than repeating it down the whole index. + if (repo->desc && !strcmp(repo->desc, default_git_desc)) { + free(repo->desc); + repo->desc = cgit_default_repo_desc; + } } if (ctx.cfg.section_from_path) { -- cgit v2.8.0