]> gitweb.ps.run Git - ps-cgit/blobdiff - cgit.c
Change toggle to more meaningful term
[ps-cgit] / cgit.c
diff --git a/cgit.c b/cgit.c
index 5a93fcdc6376a9a1ad7ac1f7090988c624481294..d1cee580cd6fe064993da8bd04acdf9f3325042b 100644 (file)
--- a/cgit.c
+++ b/cgit.c
@@ -154,6 +154,10 @@ static void querystring_cb(const char *name, const char *value)
                ctx.qry.name = xstrdup(value);
        } else if (!strcmp(name, "mimetype")) {
                ctx.qry.mimetype = xstrdup(value);
                ctx.qry.name = xstrdup(value);
        } else if (!strcmp(name, "mimetype")) {
                ctx.qry.mimetype = xstrdup(value);
+       } else if (!strcmp(name, "s")){
+               ctx.qry.sort = xstrdup(value);
+       } else if (!strcmp(name, "showmsg")) {
+               ctx.qry.showmsg = atoi(value);
        }
 }
 
        }
 }
 
@@ -254,6 +258,7 @@ static int prepare_repo_cmd(struct cgit_context *ctx)
        ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc);
 
        if (!ctx->qry.head) {
        ctx->page.title = fmt("%s - %s", ctx->repo->name, ctx->repo->desc);
 
        if (!ctx->qry.head) {
+               ctx->qry.nohead = 1;
                ctx->qry.head = find_default_branch(ctx->repo);
                ctx->repo->defbranch = ctx->qry.head;
        }
                ctx->qry.head = find_default_branch(ctx->repo);
                ctx->repo->defbranch = ctx->qry.head;
        }
@@ -434,28 +439,29 @@ int main(int argc, const char **argv)
        ctx.repo = NULL;
        http_parse_querystring(ctx.qry.raw, querystring_cb);
 
        ctx.repo = NULL;
        http_parse_querystring(ctx.qry.raw, querystring_cb);
 
-       /* If virtual-root isn't specified in cgitrc and no url
-        * parameter is specified on the querystring, lets pretend
-        * that virtualroot equals SCRIPT_NAME and use PATH_INFO as
-        * url. This allows cgit to work with virtual urls without
-        * the need for rewriterules in the webserver (as long as
-        * PATH_INFO is included in the cache lookup key).
+       /* If virtual-root isn't specified in cgitrc, lets pretend
+        * that virtual-root equals SCRIPT_NAME.
         */
         */
-       if (!ctx.cfg.virtual_root && !ctx.qry.url) {
+       if (!ctx.cfg.virtual_root)
                ctx.cfg.virtual_root = ctx.cfg.script_name;
                ctx.cfg.virtual_root = ctx.cfg.script_name;
-               path = getenv("PATH_INFO");
-               if (path) {
-                       if (path[0] == '/')
-                               path++;
-                       ctx.qry.url = xstrdup(path);
-                       if (ctx.qry.raw) {
-                               qry = ctx.qry.raw;
-                               ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
-                               free(qry);
-                       } else
-                               ctx.qry.raw = ctx.qry.url;
-                       cgit_parse_url(ctx.qry.url);
-               }
+
+       /* If no url parameter is specified on the querystring, lets
+        * use PATH_INFO as url. This allows cgit to work with virtual
+        * urls without the need for rewriterules in the webserver (as
+        * long as PATH_INFO is included in the cache lookup key).
+        */
+       path = getenv("PATH_INFO");
+       if (!ctx.qry.url && path) {
+               if (path[0] == '/')
+                       path++;
+               ctx.qry.url = xstrdup(path);
+               if (ctx.qry.raw) {
+                       qry = ctx.qry.raw;
+                       ctx.qry.raw = xstrdup(fmt("%s?%s", path, qry));
+                       free(qry);
+               } else
+                       ctx.qry.raw = ctx.qry.url;
+               cgit_parse_url(ctx.qry.url);
        }
 
        ttl = calc_ttl();
        }
 
        ttl = calc_ttl();