mirror of
https://git.zx2c4.com/cgit
synced 2025-07-24 12:45:10 +02:00
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>
This commit is contained in:
parent
747b035dda
commit
9003cc172a
4 changed files with 12 additions and 4 deletions
10
ui-diff.c
10
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue