Description in repo not used if not using scan-path
Philip Taylor
pst200 at googlemail.com
Mon Jan 20 21:47:53 CET 2014
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);
}
}
}
More information about the CGit
mailing list