X-Git-Url: https://gitweb.ps.run/ps-cgit/blobdiff_plain/4a198e4b8ee62a9a8b5156a46bfce46dc7223fe9..3f1ebd3565afa33196dfc3e8584e04564987e33c:/ui-diff.c
diff --git a/ui-diff.c b/ui-diff.c
index a92a768..a7bc667 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -34,6 +34,17 @@ static struct fileinfo {
} *items;
static int use_ssdiff = 0;
+static struct diff_filepair *current_filepair;
+
+struct diff_filespec *cgit_get_current_old_file(void)
+{
+ return current_filepair->one;
+}
+
+struct diff_filespec *cgit_get_current_new_file(void)
+{
+ return current_filepair->two;
+}
static void print_fileinfo(struct fileinfo *info)
{
@@ -92,7 +103,7 @@ static void print_fileinfo(struct fileinfo *info)
info->old_path);
html("
");
if (info->binary) {
- htmlf("bin | %d -> %d bytes",
+ htmlf("bin | %ld -> %ld bytes",
info->old_size, info->new_size);
return;
}
@@ -127,7 +138,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, count_diff_lines);
+ &binary, 0, ctx.qry.ignorews, count_diff_lines);
if (files >= slots) {
if (slots == 0)
slots = 4;
@@ -154,17 +165,36 @@ static void inspect_filepair(struct diff_filepair *pair)
}
void cgit_print_diffstat(const unsigned char *old_sha1,
- const unsigned char *new_sha1)
+ const unsigned char *new_sha1, const char *prefix)
{
- int i;
+ int i, save_context = ctx.qry.context;
html("");
html("");
max_changes = 0;
- cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, NULL);
+ cgit_diff_tree(old_sha1, new_sha1, inspect_filepair, prefix,
+ ctx.qry.ignorews);
for(i = 0; i");
@@ -268,6 +298,7 @@ static void filepair_cb(struct diff_filepair *pair)
int binary = 0;
linediff_fn print_line_fn = print_line;
+ current_filepair = pair;
if (use_ssdiff) {
cgit_ssdiff_header_begin();
print_line_fn = cgit_ssdiff_line_cb;
@@ -286,7 +317,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, 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)
@@ -338,7 +370,7 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
use_ssdiff = 1;
print_ssdiff_link();
- cgit_print_diffstat(old_rev_sha1, new_rev_sha1);
+ cgit_print_diffstat(old_rev_sha1, new_rev_sha1, prefix);
if (use_ssdiff) {
html("");
@@ -346,7 +378,8 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefi
html("");
html("| ");
}
- 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(" | ");
html(" ");
|