git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] diff-* --with-raw

From
Junio C Hamano <junkio@cox.net>
Date
Apr 11, 2006, 00:35 UTC
Message-ID
<7vr7456jb4.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<20060411002311.GW27689@pasky.or.cz>
Petr Baudis <pasky@suse.cz> writes:
> git-diff-* output is by default the raw format, and with the --with-raw
> option you tell it to furthermore include the raw format... sounds
> wrong, doesn't it? ;-) I'd call it --patch-with-raw or -P.

Since --raw-with-raw would be oximoron, I would say --with-raw would naturally mean --patch-with-raw, but that's fine.

> Also, it would be nice to handle the -c case as well. Not strictly
> necessary for cg-log right now, but other cg-Xfollowrenames users might
> want to have that for merges... (Potentially, this might break renames
> detection but the case is really obscure.)
This would cover that request, comes on top of the previous one.
--
diff --git a/combine-diff.c b/combine-diff.c
index eb0d757..748dc30 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -832,6 +832,7 @@ const char *diff_tree_combined_merge(con
 
 	diffopts = *opt;
 	diffopts.output_format = DIFF_FORMAT_NO_OUTPUT;
+	diffopts.with_raw = 0;
 	diffopts.recursive = 1;
 
 	/* count parents */
@@ -858,6 +859,15 @@ const char *diff_tree_combined_merge(con
 			num_paths++;
 	}
 	if (num_paths) {
+		if (opt->with_raw) {
+			opt->output_format = DIFF_FORMAT_RAW;
+			for (p = paths; p; p = p->next) {
+				if (show_combined_diff(p, num_parent, dense,
+						       header, opt))
+					header = NULL;
+			}
+			opt->output_format = DIFF_FORMAT_PATCH;
+		}
 		for (p = paths; p; p = p->next) {
 			if (show_combined_diff(p, num_parent, dense,
 					       header, opt))
Previous: Petr BaudisNext: Petr Baudis
Message 4 of 6 in “diff-* --with-raw”
  1. diff-* --with-rawJunio C Hamano, Apr 11, 2006
  2. Junio C HamanoApr 11, 2006
  3. Petr BaudisApr 11, 2006
  4. Junio C HamanoApr 11, 2006
  5. Rename --with-raw to --patch-with-raw and document itPetr Baudis, Apr 11, 2006
  6. Separate the raw diff and patch with a newlinePetr Baudis, Apr 11, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.