Introduce 'section' as canonical spelling for 'repo.group'

The 'repo.' prefix should be reserved for repo-specific options, but
the option 'repo.group' must still be honored to stay backwards
compatible.

Signed-off-by: Lars Hjemli <hjemli@gmail.com>
Este commit está contenido en:
Lars Hjemli 2009-08-23 22:58:39 +02:00
padre 50d5af3adc
commit e7af002d5c
Se han modificado 6 ficheros con 22 adiciones y 17 borrados

4
cgit.c
Ver fichero

@ -143,8 +143,8 @@ void config_cb(const char *name, const char *value)
ctx.cfg.local_time = atoi(value); ctx.cfg.local_time = atoi(value);
else if (!prefixcmp(name, "mimetype.")) else if (!prefixcmp(name, "mimetype."))
add_mimetype(name + 9, value); add_mimetype(name + 9, value);
else if (!strcmp(name, "repo.group")) else if (!strcmp(name, "section") || !strcmp(name, "repo.group"))
ctx.cfg.repo_group = xstrdup(value); ctx.cfg.section = xstrdup(value);
else if (!strcmp(name, "repo.url")) else if (!strcmp(name, "repo.url"))
ctx.repo = cgit_add_repo(value); ctx.repo = cgit_add_repo(value);
else if (!strcmp(name, "repo.name")) else if (!strcmp(name, "repo.name"))

Ver fichero

@ -429,7 +429,7 @@ table.diff td div.del {
text-align: right; text-align: right;
} }
table.list td.repogroup { table.list td.reposection {
font-style: italic; font-style: italic;
color: #888; color: #888;
} }

4
cgit.h
Ver fichero

@ -65,9 +65,9 @@ struct cgit_repo {
char *desc; char *desc;
char *owner; char *owner;
char *defbranch; char *defbranch;
char *group;
char *module_link; char *module_link;
char *readme; char *readme;
char *section;
char *clone_url; char *clone_url;
int snapshots; int snapshots;
int enable_log_filecount; int enable_log_filecount;
@ -156,12 +156,12 @@ struct cgit_config {
char *logo; char *logo;
char *logo_link; char *logo_link;
char *module_link; char *module_link;
char *repo_group;
char *robots; char *robots;
char *root_title; char *root_title;
char *root_desc; char *root_desc;
char *root_readme; char *root_readme;
char *script_name; char *script_name;
char *section;
char *virtual_root; char *virtual_root;
int cache_size; int cache_size;
int cache_dynamic_ttl; int cache_dynamic_ttl;

Ver fichero

@ -200,8 +200,8 @@ renamelimit::
`man git-diff`). Default value: "-1". `man git-diff`). Default value: "-1".
repo.group:: repo.group::
A value for the current repository group, which all repositories Legacy alias for 'section' which will be deprecated starting with
specified after this setting will inherit. Default value: none. cgit-1.0.
robots:: robots::
Text used as content for the "robots" meta-tag. Default value: Text used as content for the "robots" meta-tag. Default value:
@ -225,6 +225,11 @@ scan-path::
the result will be cached as a cgitrc include-file in the cache the result will be cached as a cgitrc include-file in the cache
directory. Default value: none. See also: cache-scanrc-ttl. directory. Default value: none. See also: cache-scanrc-ttl.
section:
The name of the current repository section - all repositories defined
after this option will inherit the current section name. Default value:
none.
snapshots:: snapshots::
Text which specifies the default set of snapshot formats generated by Text which specifies the default set of snapshot formats generated by
cgit. The value is a space-separated list of zero or more of the cgit. The value is a space-separated list of zero or more of the

Ver fichero

@ -53,7 +53,7 @@ struct cgit_repo *cgit_add_repo(const char *url)
ret->path = NULL; ret->path = NULL;
ret->desc = "[no description]"; ret->desc = "[no description]";
ret->owner = NULL; ret->owner = NULL;
ret->group = ctx.cfg.repo_group; ret->section = ctx.cfg.section;
ret->defbranch = "master"; ret->defbranch = "master";
ret->snapshots = ctx.cfg.snapshots; ret->snapshots = ctx.cfg.snapshots;
ret->enable_log_filecount = ctx.cfg.enable_log_filecount; ret->enable_log_filecount = ctx.cfg.enable_log_filecount;

Ver fichero

@ -203,7 +203,7 @@ int sort_repolist(char *field)
void cgit_print_repolist() void cgit_print_repolist()
{ {
int i, columns = 4, hits = 0, header = 0; int i, columns = 4, hits = 0, header = 0;
char *last_group = NULL; char *last_section = NULL;
int sorted = 0; int sorted = 0;
if (ctx.cfg.enable_index_links) if (ctx.cfg.enable_index_links)
@ -233,18 +233,18 @@ void cgit_print_repolist()
if (!header++) if (!header++)
print_header(columns); print_header(columns);
if (!sorted && if (!sorted &&
((last_group == NULL && ctx.repo->group != NULL) || ((last_section == NULL && ctx.repo->section != NULL) ||
(last_group != NULL && ctx.repo->group == NULL) || (last_section != NULL && ctx.repo->section == NULL) ||
(last_group != NULL && ctx.repo->group != NULL && (last_section != NULL && ctx.repo->section != NULL &&
strcmp(ctx.repo->group, last_group)))) { strcmp(ctx.repo->section, last_section)))) {
htmlf("<tr class='nohover'><td colspan='%d' class='repogroup'>", htmlf("<tr class='nohover'><td colspan='%d' class='reposection'>",
columns); columns);
html_txt(ctx.repo->group); html_txt(ctx.repo->section);
html("</td></tr>"); html("</td></tr>");
last_group = ctx.repo->group; last_section = ctx.repo->section;
} }
htmlf("<tr><td class='%s'>", htmlf("<tr><td class='%s'>",
!sorted && ctx.repo->group ? "sublevel-repo" : "toplevel-repo"); !sorted && ctx.repo->section ? "sublevel-repo" : "toplevel-repo");
cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL); cgit_summary_link(ctx.repo->name, ctx.repo->name, NULL, NULL);
html("</td><td>"); html("</td><td>");
html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL); html_link_open(cgit_repourl(ctx.repo->url), NULL, NULL);