diff options
| author | Lukas Fleischer | 2013-08-14 10:50:32 +0200 |
|---|---|---|
| committer | Jason A. Donenfeld | 2013-08-16 13:15:37 -0600 |
| commit | 9003cc172a4cbc6678f3d8003ae1ad3a55f62fed (patch) | |
| tree | 7ca3eae3de1a9851eeb2af473b88bdc6dab0550b /ui-diff.c | |
| parent | 747b035dda97ae359ed00d84744acfa8cc009fb2 (diff) | |
| download | cgit-9003cc172a4cbc6678f3d8003ae1ad3a55f62fed.tar.gz cgit-9003cc172a4cbc6678f3d8003ae1ad3a55f62fed.tar.bz2 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.c | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -358,7 +358,7 @@ void cgit_print_diff_ctrls() | |||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | void cgit_print_diff(const char *new_rev, const char *old_rev, | 360 | void cgit_print_diff(const char *new_rev, const char *old_rev, |
| 361 | const char *prefix, int show_ctrls) | 361 | const char *prefix, int show_ctrls, int raw) |
| 362 | { | 362 | { |
| 363 | enum object_type type; | 363 | enum object_type type; |
| 364 | unsigned long size; | 364 | unsigned long size; |
| @@ -398,6 +398,14 @@ void cgit_print_diff(const char *new_rev, const char *old_rev, | |||
| 398 | } | 398 | } |
| 399 | } | 399 | } |
| 400 | 400 | ||
| 401 | if (raw) { | ||
| 402 | ctx.page.mimetype = "text/plain"; | ||
| 403 | cgit_print_http_headers(&ctx); | ||
| 404 | cgit_diff_tree(old_rev_sha1, new_rev_sha1, filepair_cb_raw, | ||
| 405 | prefix, 0); | ||
| 406 | return; | ||
| 407 | } | ||
| 408 | |||
| 401 | use_ssdiff = ctx.qry.has_ssdiff ? ctx.qry.ssdiff : ctx.cfg.ssdiff; | 409 | use_ssdiff = ctx.qry.has_ssdiff ? ctx.qry.ssdiff : ctx.cfg.ssdiff; |
| 402 | 410 | ||
| 403 | if (show_ctrls) | 411 | if (show_ctrls) |
