summaryrefslogtreecommitdiff
path: root/ui-diff.c
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2013-08-14 08:50:32 +0000
committerJason A. Donenfeld <Jason@zx2c4.com>2013-08-16 19:15:37 +0000
commit9003cc172a4cbc6678f3d8003ae1ad3a55f62fed (patch)
tree7ca3eae3de1a9851eeb2af473b88bdc6dab0550b /ui-diff.c
parent747b035dda97ae359ed00d84744acfa8cc009fb2 (diff)
downloadcgit-9003cc172a4cbc6678f3d8003ae1ad3a55f62fed.tar
cgit-9003cc172a4cbc6678f3d8003ae1ad3a55f62fed.tar.gz
cgit-9003cc172a4cbc6678f3d8003ae1ad3a55f62fed.zip
Allow for creating raw diffs with cgit_print_diff()
This adds a parameter to cgit_print_diff() to create raw diffs, using the same format as `git diff <commit>`. Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'ui-diff.c')
-rw-r--r--ui-diff.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/ui-diff.c b/ui-diff.c
index 8b38209..838db8c 100644
--- a/ui-diff.c
+++ b/ui-diff.c
@@ -358,7 +358,7 @@ void cgit_print_diff_ctrls()
}
void cgit_print_diff(const char *new_rev, const char *old_rev,
- const char *prefix, int show_ctrls)
+ const char *prefix, int show_ctrls, int raw)
{
enum object_type type;
unsigned long size;
@@ -398,6 +398,14 @@ void cgit_print_diff(const char *new_rev, const char *old_rev,
}
}
+ if (raw) {
+ ctx.page.mimetype = "text/plain";
+ cgit_print_http_headers(&ctx);
+ cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb_raw,
+ prefix, 0);
+ return;
+ }
+
use_ssdiff = ctx.qry.has_ssdiff ? ctx.qry.ssdiff : ctx.cfg.ssdiff;
if (show_ctrls)