author | Johan Herland <johan@herland.net> | 2010-06-10 18:15:27 (UTC) |
---|---|---|
committer | Lars Hjemli <hjemli@gmail.com> | 2010-06-19 11:00:07 (UTC) |
commit | 6180e6169d6e87a3bea7e4da835dca17f93e5cfd (patch) (side-by-side diff) | |
tree | 7caa053b419c75081179cc4a6056ce6533d01d99 /ui-diff.c | |
parent | a2cbd3c30b64a26b52b2003ba6569f3c083f4092 (diff) | |
download | cgit-6180e6169d6e87a3bea7e4da835dca17f93e5cfd.zip cgit-6180e6169d6e87a3bea7e4da835dca17f93e5cfd.tar.gz cgit-6180e6169d6e87a3bea7e4da835dca17f93e5cfd.tar.bz2 |
Add URL parameter 'context' for changing the number of context lines in diffs
The new ctx.qry.context variable is picked up by cgit_print_diff(), and
passed via cgit_diff_files() to Git's diff machinery.
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Lars Hjemli <hjemli@gmail.com>
-rw-r--r-- | ui-diff.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -118,25 +118,25 @@ static void count_diff_lines(char *line, int len) } } static void inspect_filepair(struct diff_filepair *pair) { int binary = 0; unsigned long old_size = 0; unsigned long new_size = 0; files++; 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, count_diff_lines); if (files >= slots) { if (slots == 0) slots = 4; else slots = slots * 2; items = xrealloc(items, slots * sizeof(struct fileinfo)); } items[files-1].status = pair->status; hashcpy(items[files-1].old_sha1, pair->one->sha1); hashcpy(items[files-1].new_sha1, pair->two->sha1); items[files-1].old_mode = pair->one->mode; items[files-1].new_mode = pair->two->mode; @@ -279,25 +279,25 @@ static void filepair_cb(struct diff_filepair *pair) if (use_ssdiff) cgit_ssdiff_header_end(); if (S_ISGITLINK(pair->one->mode) || S_ISGITLINK(pair->two->mode)) { if (S_ISGITLINK(pair->one->mode)) print_line_fn(fmt("-Subproject %s", sha1_to_hex(pair->one->sha1)), 52); if (S_ISGITLINK(pair->two->mode)) print_line_fn(fmt("+Subproject %s", sha1_to_hex(pair->two->sha1)), 52); if (use_ssdiff) cgit_ssdiff_footer(); 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, print_line_fn)) cgit_print_error("Error running diff"); if (binary) { if (use_ssdiff) html("<tr><td colspan='4'>Binary files differ</td></tr>"); else html("Binary files differ"); } if (use_ssdiff) cgit_ssdiff_footer(); } void cgit_print_diff(const char *new_rev, const char *old_rev, const char *prefix) |