mirror of
https://git.zx2c4.com/cgit
synced 2024-11-22 16:38:42 +00:00
Fix diff mode switching when side-by-side-diffs=1
When side-by-side-diffs=1 was set in cgitrc, specyfing 'ss=0' in the query- string would not switch to unified diffs. This patch fixes the issue by introducing a separate variable to track the occurrence of "ss" in the querystring.
This commit is contained in:
parent
0b6a716d1b
commit
f2ced535e9
1
cgit.c
1
cgit.c
@ -281,6 +281,7 @@ static void querystring_cb(const char *name, const char *value)
|
|||||||
ctx.qry.period = xstrdup(value);
|
ctx.qry.period = xstrdup(value);
|
||||||
} else if (!strcmp(name, "ss")) {
|
} else if (!strcmp(name, "ss")) {
|
||||||
ctx.qry.ssdiff = atoi(value);
|
ctx.qry.ssdiff = atoi(value);
|
||||||
|
ctx.qry.has_ssdiff = 1;
|
||||||
} else if (!strcmp(name, "all")) {
|
} else if (!strcmp(name, "all")) {
|
||||||
ctx.qry.show_all = atoi(value);
|
ctx.qry.show_all = atoi(value);
|
||||||
} else if (!strcmp(name, "context")) {
|
} else if (!strcmp(name, "context")) {
|
||||||
|
1
cgit.h
1
cgit.h
@ -133,6 +133,7 @@ struct reflist {
|
|||||||
struct cgit_query {
|
struct cgit_query {
|
||||||
int has_symref;
|
int has_symref;
|
||||||
int has_sha1;
|
int has_sha1;
|
||||||
|
int has_ssdiff;
|
||||||
char *raw;
|
char *raw;
|
||||||
char *repo;
|
char *repo;
|
||||||
char *page;
|
char *page;
|
||||||
|
@ -372,8 +372,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ctx.qry.ssdiff && !ctx.cfg.ssdiff) || (!ctx.qry.ssdiff && ctx.cfg.ssdiff))
|
use_ssdiff = ctx.qry.has_ssdiff ? ctx.qry.ssdiff : ctx.cfg.ssdiff;
|
||||||
use_ssdiff = 1;
|
|
||||||
|
|
||||||
print_ssdiff_link();
|
print_ssdiff_link();
|
||||||
cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix);
|
cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix);
|
||||||
|
Loading…
Reference in New Issue
Block a user