/* cgit.c: cgi for the git scm
*
* Copyright (C) 2006-2014 cgit Development Team <cgit@lists.zx2c4.com>
*
* Licensed under GNU General Public License v2
* (see COPYING for full license text)
*/
#include "cgit.h"
#include "cache.h"
#include "cmd.h"
#include "configfile.h"
#include "html.h"
#include "ui-shared.h"
#include "ui-stats.h"
#include "ui-blob.h"
#include "ui-summary.h"
#include "scan-tree.h"
const char *cgit_version = CGIT_VERSION;
static void add_mimetype(const char *name, const char *value)
{
struct string_list_item *item;
item = string_list_insert(&ctx.cfg.mimetypes, xstrdup(name));
item->util = xstrdup(value);
}
static void process_cached_repolist(const char *path);
static void repo_config(struct cgit_repo *repo, const char *name, const char *value)
{
struct string_list_item *item;
if (!strcmp(name, "name"))
repo->name = xstrdup(value);
else if (!strcmp(name, "clone-url"))
repo->clone_url = xstrdup(value);
else if (!strcmp(name, "desc"))
repo->desc = xstrdup(value);
else if (!strcmp(name, "owner"))
repo->owner = xstrdup(value);
else if (!strcmp(name, "defbranch"))
repo->defbranch = xstrdup(value);
else if (!strcmp(name, "snapshots"))
repo->snapshots = ctx.cfg.snapshots & cgit_parse_snapshots_mask(value);
else if (!strcmp(name, "enable-commit-graph"))
repo->enable_commit_graph = atoi(value);
else if (!strcmp(name, "enable-log-filecount"))
repo->enable_log_filecount = atoi(value);
else if (!strcmp(name, "enable-log-linecount"))
repo->enable_log_linecount = atoi(value);
else if (!strcmp(name, "enable-remote-branches"))
repo->enable_remote_branches = atoi(value);
else if (!strcmp(name, "enable-subject-links"))
repo->enable_subject_links = atoi(value);
else if (!strcmp(name, "branch-sort")) {
if (!strcmp(value, "age"))
repo->branch_sort = 1;
if (!strcmp(value, "name"))
repo->branch_sort = 0;
} else if (!strcmp(name, "commit-sort")) {
if (!strcmp(value, "date"))
repo->commit_sort = 1;
if (!strcmp(value, "topo"))
repo->commit_sort = 2;
} else if (!strcmp(name, "max-stats"))
repo->max_stats = cgit_find_stats_period(value, NULL);
else if (!strcmp(name, "module-link"))
repo->module_link= xstrdup(value);
else if (starts_with(name, "module-link.")) {
item = string_list_append(&repo->submodules, xstrdup(name + 12));
item->util = xstrdup(value);
} else if (!strcmp(name, "section"))
repo->section = xstrdup(value);
else if (!strcmp(name, "readme") && value != NULL) {
if (repo->readme.items == ctx.cfg.readme.items)
memset(&repo->readme