git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] combine-diff consistency fixes
@ 2006-02-27 12:48 Mark Wooding
  2006-02-27 12:52 ` [PATCH 1/2] combine-diff: Honour --full-index Mark Wooding
  2006-02-27 12:52 ` [PATCH 2/2] combine-diff: Honour -z option correctly Mark Wooding
  0 siblings, 2 replies; 3+ messages in thread
From: Mark Wooding @ 2006-02-27 12:48 UTC (permalink / raw)
  To: git

The output of git diff-tree --cc on a merge is not consistent with its
output for a normal commit.  In particular:

  * the index lines on a combined diff are abbreviated even if
    --full-index is given, and

  * the headers on a combined diff are not null terminated, even if -z
    is given.

For example, run

  git-diff-tree --cc -z --full-index f0b0af1b04f558b684cae2a3b805ca4bab84d45f

-- [mdw]

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

* [PATCH 1/2] combine-diff: Honour --full-index.
  2006-02-27 12:48 [PATCH 0/2] combine-diff consistency fixes Mark Wooding
@ 2006-02-27 12:52 ` Mark Wooding
  2006-02-27 12:52 ` [PATCH 2/2] combine-diff: Honour -z option correctly Mark Wooding
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Wooding @ 2006-02-27 12:52 UTC (permalink / raw)
  To: git

From: Mark Wooding <mdw@distorted.org.uk>

For some reason, combined diffs don't honour the --full-index flag when
emitting patches.  Fix this.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
---

 combine-diff.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index d812600..984103e 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -621,7 +621,8 @@ static void reuse_combine_diff(struct sl
 }
 
 static int show_patch_diff(struct combine_diff_path *elem, int num_parent,
-			   int dense, const char *header)
+			   int dense, const char *header,
+			   struct diff_options *opt)
 {
 	unsigned long size, cnt, lno;
 	char *result, *cp, *ep;
@@ -631,6 +632,7 @@ static int show_patch_diff(struct combin
 	char ourtmp_buf[TMPPATHLEN];
 	char *ourtmp = ourtmp_buf;
 	int working_tree_file = !memcmp(elem->sha1, null_sha1, 20);
+	int abbrev = opt->full_index ? 40 : DEFAULT_ABBREV;
 
 	/* Read the result of merge first */
 	if (!working_tree_file) {
@@ -735,10 +737,10 @@ static int show_patch_diff(struct combin
 		printf("index ");
 		for (i = 0; i < num_parent; i++) {
 			abb = find_unique_abbrev(elem->parent[i].sha1,
-						 DEFAULT_ABBREV);
+						 abbrev);
 			printf("%s%s", i ? "," : "", abb);
 		}
-		abb = find_unique_abbrev(elem->sha1, DEFAULT_ABBREV);
+		abb = find_unique_abbrev(elem->sha1, abbrev);
 		printf("..%s\n", abb);
 
 		if (mode_differs) {
@@ -862,7 +864,7 @@ int show_combined_diff(struct combine_di
 
 	default:
 	case DIFF_FORMAT_PATCH:
-		return show_patch_diff(p, num_parent, dense, header);
+		return show_patch_diff(p, num_parent, dense, header, opt);
 	}
 }
 

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

* [PATCH 2/2] combine-diff: Honour -z option correctly.
  2006-02-27 12:48 [PATCH 0/2] combine-diff consistency fixes Mark Wooding
  2006-02-27 12:52 ` [PATCH 1/2] combine-diff: Honour --full-index Mark Wooding
@ 2006-02-27 12:52 ` Mark Wooding
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Wooding @ 2006-02-27 12:52 UTC (permalink / raw)
  To: git

From: Mark Wooding <mdw@distorted.org.uk>

Combined diffs don't null terminate things in the same way as standard
diffs.  This is presumably wrong.

Signed-off-by: Mark Wooding <mdw@distorted.org.uk>
---

 combine-diff.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/combine-diff.c b/combine-diff.c
index 984103e..a23894d 100644
--- a/combine-diff.c
+++ b/combine-diff.c
@@ -726,7 +726,7 @@ static int show_patch_diff(struct combin
 
 		if (header) {
 			shown_header++;
-			puts(header);
+			printf("%s%c", header, opt->line_termination);
 		}
 		printf("diff --%s ", dense ? "cc" : "combined");
 		if (quote_c_style(elem->path, NULL, NULL, 0))
@@ -799,7 +799,7 @@ static void show_raw_diff(struct combine
 		inter_name_termination = 0;
 
 	if (header)
-		puts(header);
+		printf("%s%c", header, line_termination);
 
 	for (i = 0; i < num_parent; i++) {
 		if (p->parent[i].mode)

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

end of thread, other threads:[~2006-02-27 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-27 12:48 [PATCH 0/2] combine-diff consistency fixes Mark Wooding
2006-02-27 12:52 ` [PATCH 1/2] combine-diff: Honour --full-index Mark Wooding
2006-02-27 12:52 ` [PATCH 2/2] combine-diff: Honour -z option correctly Mark Wooding

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