mirror of
https://git.zx2c4.com/cgit
synced 2025-06-24 18:58:39 +02:00
Add URL parameter 'ignorews' for optionally ignoring whitespace in diffs
The new ctx.qry.ignorews variable is passed via cgit_diff_files() and cgit_diff_tree() to Git's diff machinery. This is equivalent to passing --ignore-all-space to 'git diff'. Signed-off-by: Johan Herland <johan@herland.net>
This commit is contained in:
parent
d20313e3da
commit
2cc8b99f08
6 changed files with 25 additions and 12 deletions
11
ui-diff.c
11
ui-diff.c
|
@ -127,7 +127,7 @@ static void inspect_filepair(struct diff_filepair *pair)
|
|||
lines_added = 0;
|
||||
lines_removed = 0;
|
||||
cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size, &new_size,
|
||||
&binary, 0, count_diff_lines);
|
||||
&binary, 0, ctx.qry.ignorews, count_diff_lines);
|
||||
if (files >= slots) {
|
||||
if (slots == 0)
|
||||
slots = 4;
|
||||
|
@ -174,7 +174,8 @@ void cgit_print_diffstat(const unsigned char *old_sha1,
|
|||
html("</div>");
|
||||
html("<table summary='diffstat' class='diffstat'>");
|
||||
max_changes = 0;
|
||||
cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix);
|
||||
cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix,
|
||||
ctx.qry.ignorews);
|
||||
for(i = 0; i<files; i++)
|
||||
print_fileinfo(&items[i]);
|
||||
html("</table>");
|
||||
|
@ -296,7 +297,8 @@ static void filepair_cb(struct diff_filepair *pair)
|
|||
return;
|
||||
}
|
||||
if (cgit_diff_files(pair->one->sha1, pair->two->sha1, &old_size,
|
||||
&new_size, &binary, ctx.qry.context, print_line_fn))
|
||||
&new_size, &binary, ctx.qry.context,
|
||||
ctx.qry.ignorews, print_line_fn))
|
||||
cgit_print_error("Error running diff");
|
||||
if (binary) {
|
||||
if (use_ssdiff)
|
||||
|
@ -356,7 +358,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
|
|||
html("<table summary='diff' class='diff'>");
|
||||
html("<tr><td>");
|
||||
}
|
||||
cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix);
|
||||
cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb, prefix,
|
||||
ctx.qry.ignorews);
|
||||
if (!use_ssdiff)
|
||||
html("</td></tr>");
|
||||
html("</table>");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue