about summary refs log tree commit diff
path: root/cmd.c
diff options
context:
space:
mode:
authorLukas Fleischer <cgit@cryptocrack.de>2013-08-14 10:50:33 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2013-08-16 13:15:37 -0600
commit445f6ae8e3ef19b6ca70e741e934778bc4a05555 (patch)
tree5cf2b91951d050e1b7b2fc76a056de93ad5cd66f /cmd.c
parentAllow for creating raw diffs with cgit_print_diff() (diff)
downloadcgit-pink-445f6ae8e3ef19b6ca70e741e934778bc4a05555.tar.gz
cgit-pink-445f6ae8e3ef19b6ca70e741e934778bc4a05555.zip
cmd.c: Add a "rawdiff" command
This can be used to generate raw diffs between arbitrary revisions using
something like

     /rawdiff/?id=v0.9&id2=v0.9.1

Signed-off-by: Lukas Fleischer <cgit@cryptocrack.de>
Diffstat (limited to 'cmd.c')
-rw-r--r--cmd.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/cmd.c b/cmd.c
index 10761ce..9893710 100644
--- a/cmd.c
+++ b/cmd.c
@@ -60,6 +60,11 @@ static void diff_fn(struct cgit_context *ctx)
 	cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1, 0);
 }
 
+static void rawdiff_fn(struct cgit_context *ctx)
+{
+	cgit_print_diff(ctx->qry.sha1, ctx->qry.sha2, ctx->qry.path, 1, 1);
+}
+
 static void info_fn(struct cgit_context *ctx)
 {
 	cgit_clone_info(ctx);
@@ -150,6 +155,7 @@ struct cgit_cmd *cgit_get_cmd(struct cgit_context *ctx)
 		def_cmd(objects, 1, 0, 0, 1),
 		def_cmd(patch, 1, 0, 1, 0),
 		def_cmd(plain, 1, 0, 0, 0),
+		def_cmd(rawdiff, 1, 0, 1, 0),
 		def_cmd(refs, 1, 1, 0, 0),
 		def_cmd(repolist, 0, 0, 0, 0),
 		def_cmd(snapshot, 1, 0, 0, 0),