git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] combine-diff: use diff_opts->a_prefix
@ 2007-12-25 13:46 Salikh Zakirov
  2007-12-27  0:57 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Salikh Zakirov @ 2007-12-25 13:46 UTC (permalink / raw)
  To: Junio C Hamano, Git Mailing List


The introduction of configurable dir prefix for diff headers in commit
eab9a40b 'Teach diff machinery to display other prefixes than "a/" and "b/"'
missed combined diff generation.

Signed-off-by: Salikh Zakirov <salikh@gmail.com>
---

I realize that this fix is ugly, so I am all ears for a suggestion
of a better fix.

 combine-diff.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index e22db89..5c3b42d 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -646,10 +646,11 @@ static void reuse_combine_diff(struct sline *sline, unsigned long cnt,
 	sline->p_lno[i] = sline->p_lno[j];
 }
 
-static void dump_quoted_path(const char *prefix, const char *path,
-			     const char *c_meta, const char *c_reset)
+static void dump_quoted_path(const char *prefix, const char *prefix2,
+                             const char *path, const char *c_meta,
+			     const char *c_reset)
 {
-	printf("%s%s", c_meta, prefix);
+	printf("%s%s%s", c_meta, prefix, prefix2);
 	quote_c_style(path, NULL, stdout, 0);
 	printf("%s\n", c_reset);
 }
@@ -792,7 +793,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 
 		if (rev->loginfo && !rev->no_commit_id)
 			show_log(rev, opt->msg_sep);
-		dump_quoted_path(dense ? "diff --cc " : "diff --combined ",
+		dump_quoted_path(dense ? "diff --cc " : "diff --combined ", "",
 				 elem->path, c_meta, c_reset);
 		printf("%sindex ", c_meta);
 		for (i = 0; i < num_parent; i++) {
@@ -829,13 +830,15 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
 			printf("%s\n", c_reset);
 		}
 		if (added)
-			dump_quoted_path("--- /dev/", "null", c_meta, c_reset);
+			dump_quoted_path("--- /dev/", "", "null", c_meta, c_reset);
 		else
-			dump_quoted_path("--- a/", elem->path, c_meta, c_reset);
+			dump_quoted_path("--- ", opt->a_prefix, elem->path,
+			                 c_meta, c_reset);
 		if (deleted)
-			dump_quoted_path("+++ /dev/", "null", c_meta, c_reset);
+			dump_quoted_path("+++ /dev/", "", "null", c_meta, c_reset);
 		else
-			dump_quoted_path("+++ b/", elem->path, c_meta, c_reset);
+			dump_quoted_path("+++ ", opt->b_prefix, elem->path,
+			                 c_meta, c_reset);
 		dump_sline(sline, cnt, num_parent, DIFF_OPT_TST(opt, COLOR_DIFF));
 	}
 	free(result);
-- 
1.5.3.7.1315.g1b8e7

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

end of thread, other threads:[~2007-12-27  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-25 13:46 [PATCH] combine-diff: use diff_opts->a_prefix Salikh Zakirov
2007-12-27  0:57 ` Junio C Hamano
2007-12-27  1:19   ` [PATCH] Fix rewrite_diff() name quoting Junio C Hamano

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).