git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] diff-* --with-raw
@ 2006-04-11  0:00 Junio C Hamano
  2006-04-11  0:06 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2006-04-11  0:00 UTC (permalink / raw)
  To: git; +Cc: pasky

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;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-04-11 11:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-11  0:00 [PATCH] diff-* --with-raw Junio C Hamano
2006-04-11  0:06 ` Junio C Hamano
2006-04-11  0:23   ` Petr Baudis
2006-04-11  0:35     ` Junio C Hamano
2006-04-11 11:22       ` [PATCH] Rename --with-raw to --patch-with-raw and document it Petr Baudis
2006-04-11 11:30       ` [PATCH] Separate the raw diff and patch with a newline Petr Baudis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).