DORMANTno replies

[PATCH] diff-* --with-raw

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:42:23
Subsystem: the rest · Maintainer: Linus Torvalds

Pasky wanted to have an option to get both diff-raw output and
diff-patch output.  This implements "git-diff-* --with-raw"
(which obviously implies -p as well) to do so.

Because all the necessary information is already on extended
header lines such as "index xxxxxx..yyyyyy" and "rename from"
lines, this is not strictly necessary, but if it helps
Porcelains...

--
diff --git a/diff.c b/diff.c
index 2fa285a..1a9fdab 100644
--- a/diff.c
+++ b/diff.c
@@ -862,6 +862,10 @@ int diff_opt_parse(struct diff_options *
 	const char *arg = av[0];
 	if (!strcmp(arg, "-p") || !strcmp(arg, "-u"))
 		options->output_format = DIFF_FORMAT_PATCH;
+	else if (!strcmp(arg, "--with-raw")) {
+		options->output_format = DIFF_FORMAT_PATCH;
+		options->with_raw = 1;
+	}
 	else if (!strcmp(arg, "-z"))
 		options->line_termination = 0;
 	else if (!strncmp(arg, "-l", 2))
@@ -1293,6 +1297,10 @@ void diff_flush(struct diff_options *opt
 		default:
 			switch (diff_output_format) {
 			case DIFF_FORMAT_PATCH:
+				if (options->with_raw)
+					diff_flush_raw(p, line_termination,
+						       inter_name_termination,
+						       options);
 				diff_flush_patch(p, options);
 				break;
 			case DIFF_FORMAT_RAW:
diff --git a/diff.h b/diff.h
index a02ef28..07b153b 100644
--- a/diff.h
+++ b/diff.h
@@ -24,6 +24,7 @@ struct diff_options {
 	const char *orderfile;
 	const char *pickaxe;
 	unsigned recursive:1,
+		 with_raw:1,
 		 tree_in_recursive:1,
 		 full_index:1;
 	int break_opt;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help