Add support for "robots" meta-tag
[cgit.git] / shared.c
index e06df91bb8c74a617fa95d67e8b0737b4a1099cb..fd8b1e33580cff40b1564e593db9b0abdbcdbaa5 100644 (file)
--- a/shared.c
+++ b/shared.c
@@ -26,6 +26,7 @@ char *cgit_virtual_root = NULL;
 char *cgit_script_name  = CGIT_SCRIPT_NAME;
 char *cgit_cache_root   = CGIT_CACHE_ROOT;
 char *cgit_repo_group   = NULL;
+char *cgit_robots       = "index, nofollow";
 
 int cgit_nocache               =  0;
 int cgit_snapshots             =  0;
@@ -157,9 +158,11 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_logo_link = xstrdup(value);
        else if (!strcmp(name, "module-link"))
                cgit_module_link = xstrdup(value);
-       else if (!strcmp(name, "virtual-root"))
+       else if (!strcmp(name, "virtual-root")) {
                cgit_virtual_root = trim_end(value, '/');
-       else if (!strcmp(name, "nocache"))
+               if (!cgit_virtual_root && (!strcmp(value, "/")))
+                       cgit_virtual_root = "";
+       } else if (!strcmp(name, "nocache"))
                cgit_nocache = atoi(value);
        else if (!strcmp(name, "snapshots"))
                cgit_snapshots = cgit_parse_snapshots_mask(value);
@@ -195,6 +198,8 @@ void cgit_global_config_cb(const char *name, const char *value)
                cgit_agefile = xstrdup(value);
        else if (!strcmp(name, "renamelimit"))
                cgit_renamelimit = atoi(value);
+       else if (!strcmp(name, "robots"))
+               cgit_robots = xstrdup(value);
        else if (!strcmp(name, "repo.group"))
                cgit_repo_group = xstrdup(value);
        else if (!strcmp(name, "repo.url"))
@@ -265,6 +270,8 @@ void *cgit_free_commitinfo(struct commitinfo *info)
        free(info->committer);
        free(info->committer_email);
        free(info->subject);
+       free(info->msg);
+       free(info->msg_encoding);
        free(info);
        return NULL;
 }