From mboxrd@z Thu Jan 1 00:00:00 1970 From: pst200 at googlemail.com (Philip Taylor) Date: Mon, 20 Jan 2014 20:47:53 +0000 Subject: Description in repo not used if not using scan-path In-Reply-To: <52CDD530.6020005@googlemail.com> References: <52CDD530.6020005@googlemail.com> Message-ID: <52DD8B79.6050109@googlemail.com> I have created a function to post-process the loaded cgitrc file to load the description of any repo that is the default cgit description. This is called after the "parse_configfile(expand_macros(ctx.env.cgit_config), config_cb);" line. The code is pasted below for information. static void find_missing_descriptions() { int idx; /* copied from scan-tree.c, add_repo */ struct cgit_repo *repo; size_t size; struct stat st; for ( idx=0; idx < cgit_repolist.count; idx++ ) { struct strbuf path = STRBUF_INIT; /* copied from ui-repolist.c, cgit_print_repolist() */ repo = &cgit_repolist.repos[idx]; strbuf_add(&path, repo->path, strlen(repo->path)); strbuf_addch(&path, '/'); /* When the path is stored in the repo, the final slash is removed, so add it back in */ /* copied from scan-tree.c, add_repo */ if (repo->desc == cgit_default_repo_desc || !repo->desc) { strbuf_addstr(&path, "description"); if (!stat(path.buf, &st)) readfile(path.buf, &repo->desc, &size); } } }