aboutsummaryrefslogtreecommitdiffstats
path: root/cgit.c
diff options
context:
space:
mode:
authorJohn Keeping <john@keeping.me.uk>2014-10-05 10:59:04 +0100
committerLukas Fleischer <cgit@cryptocrack.de>2014-12-13 12:38:42 +0100
commit1830271c5958526425f92ae2b369646b54e3c370 (patch)
tree545cca72fa7f672fe0a728f25a545dce10961d1d /cgit.c
parent03f537f1a134c8578ae4c16055596539fbbcc220 (diff)
Change "ss" diff flag to an enum
This will allow us to introduce a new "stat only" diff mode without needing an explosion of mutually incompatible flags. The old "ss" query parameter is still accepted in order to avoid breaking saved links, but we no longer generate any URIs using it; instead the new "dt" (diff type) parameter is used. Signed-off-by: John Keeping <john@keeping.me.uk>
Diffstat (limited to 'cgit.c')
-rw-r--r--cgit.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/cgit.c b/cgit.c
index 8c4517d..db60107 100644
--- a/cgit.c
+++ b/cgit.c
@@ -237,7 +237,7 @@ static void config_cb(const char *name, const char *value)
else if (!strcmp(name, "summary-tags"))
ctx.cfg.summary_tags = atoi(value);
else if (!strcmp(name, "side-by-side-diffs"))
- ctx.cfg.ssdiff = atoi(value);
+ ctx.cfg.difftype = atoi(value) ? DIFF_SSDIFF : DIFF_UNIFIED;
else if (!strcmp(name, "agefile"))
ctx.cfg.agefile = xstrdup(value);
else if (!strcmp(name, "mimetype-file"))
@@ -312,9 +312,13 @@ static void querystring_cb(const char *name, const char *value)
ctx.qry.showmsg = atoi(value);
} else if (!strcmp(name, "period")) {
ctx.qry.period = xstrdup(value);
+ } else if (!strcmp(name, "dt")) {
+ ctx.qry.difftype = atoi(value);
+ ctx.qry.has_difftype = 1;
} else if (!strcmp(name, "ss")) {
- ctx.qry.ssdiff = atoi(value);
- ctx.qry.has_ssdiff = 1;
+ /* No longer generated, but there may be links out there. */
+ ctx.qry.difftype = atoi(value) ? DIFF_SSDIFF : DIFF_UNIFIED;
+ ctx.qry.has_difftype = 1;
} else if (!strcmp(name, "all")) {
ctx.qry.show_all = atoi(value);
} else if (!strcmp(name, "context")) {
@@ -372,7 +376,7 @@ static void prepare_context(void)
ctx.cfg.summary_log = 10;
ctx.cfg.summary_tags = 10;
ctx.cfg.max_atom_items = 10;
- ctx.cfg.ssdiff = 0;
+ ctx.cfg.difftype = DIFF_UNIFIED;
ctx.env.cgit_config = getenv("CGIT_CONFIG");
ctx.env.http_host = getenv("HTTP_HOST");
ctx.env.https = getenv("HTTPS");