diff options
-rw-r--r-- | cmd.c | 2 | ||||
-rw-r--r-- | ui-commit.c | 2 | ||||
-rw-r--r-- | ui-diff.c | 10 | ||||
-rw-r--r-- | ui-diff.h | 2 |
4 files changed, 12 insertions, 4 deletions
diff --git a/cmd.c b/cmd.c index abe8e46..10761ce 100644 --- a/cmd.c +++ b/cmd.c | |||
@@ -57,7 +57,7 @@ static void commit_fn(struct cgit_context *ctx) | |||
57 | 57 | ||
58 | static void diff_fn(struct cgit_context *ctx) | 58 | static void diff_fn(struct cgit_context *ctx) |
59 | { | 59 | { |
60 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1); | 60 | cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1, 0); |
61 | } | 61 | } |
62 | 62 | ||
63 | static void info_fn(struct cgit_context *ctx) | 63 | static void info_fn(struct cgit_context *ctx) |
diff --git a/ui-commit.c b/ui-commit.c index a5a6ea8..ef85a49 100644 --- a/ui-commit.c +++ b/ui-commit.c | |||
@@ -137,7 +137,7 @@ void cgit_print_commit(char *hex, const char *prefix) | |||
137 | tmp = sha1_to_hex(commit->parents->item->object.sha1); | 137 | tmp = sha1_to_hex(commit->parents->item->object.sha1); |
138 | else | 138 | else |
139 | tmp = NULL; | 139 | tmp = NULL; |
140 | cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0); | 140 | cgit_print_diff(ctx.qry.sha1, tmp, prefix, 0, 0); |
141 | } | 141 | } |
142 | strbuf_release(¬es); | 142 | strbuf_release(¬es); |
143 | cgit_free_commitinfo(info); | 143 | cgit_free_commitinfo(info); |
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() | |||
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) |
diff --git a/ui-diff.h b/ui-diff.h index 25a9296..04f9029 100644 --- a/ui-diff.h +++ b/ui-diff.h | |||
@@ -4,7 +4,7 @@ | |||
4 | extern void cgit_print_diff_ctrls(); | 4 | extern void cgit_print_diff_ctrls(); |
5 | 5 | ||
6 | extern void cgit_print_diff(const char *new_hex, const char *old_hex, | 6 | extern void cgit_print_diff(const char *new_hex, const char *old_hex, |
7 | const char *prefix, int show_ctrls); | 7 | const char *prefix, int show_ctrls, int raw); |
8 | 8 | ||
9 | extern struct diff_filespec *cgit_get_current_old_file(void); | 9 | extern struct diff_filespec *cgit_get_current_old_file(void); |
10 | extern struct diff_filespec *cgit_get_current_new_file(void); | 10 | extern struct diff_filespec *cgit_get_current_new_file(void); |