* Description in repo not used if not using scan-path
@ 2014-01-08 22:46 pst200
2014-01-20 20:47 ` pst200
0 siblings, 1 reply; 3+ messages in thread
From: pst200 @ 2014-01-08 22:46 UTC (permalink / raw)
Hello,
I have previously used scab-path for each folder of git repos. When I do
this, it automatically selects the description that I put in the repo
"description" file.
When I tried to manually specify a path to a repo, it doesn't appear to
automatically use the description from the "description" file, and I
just get "[no description]". I know the description is there as looking
for the repo using scan-path, the description is present.
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
* Description in repo not used if not using scan-path
2014-01-08 22:46 Description in repo not used if not using scan-path pst200
@ 2014-01-20 20:47 ` pst200
2014-01-20 20:52 ` Jason
0 siblings, 1 reply; 3+ messages in thread
From: pst200 @ 2014-01-20 20:47 UTC (permalink / raw)
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);
}
}
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Description in repo not used if not using scan-path
2014-01-20 20:47 ` pst200
@ 2014-01-20 20:52 ` Jason
0 siblings, 0 replies; 3+ messages in thread
From: Jason @ 2014-01-20 20:52 UTC (permalink / raw)
It looks like we get description from gitweb.description, inside the git config:
else if (!strcmp(key, "gitweb.description"))
config_fn(repo, "desc", value);
We alternatively get it from the description file:
if (repo->desc == cgit_default_repo_desc || !repo->desc) {
strbuf_addstr(path, "description");
if (!stat(path->buf, &st))
readfile(path->buf, &repo->desc, &size);
strbuf_setlen(path, pathlen);
}
It may be smart to support both of these in that function. I'll see if
I can build in description scanning. I'm not completely convinced we
want it (after all, scan-path is _not_ defined in this case), but I'll
look into it.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-01-20 20:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-08 22:46 Description in repo not used if not using scan-path pst200
2014-01-20 20:47 ` pst200
2014-01-20 20:52 ` Jason
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).