Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] git-diff: fix combined diff

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

Possibly related (same subject, not in this thread)

Junio C Hamano [off-list ref] writes:
With this,

	$ git diff maint master next pu

starts working as planned ;-).
By the way, your commit log message does not seem to say
why it is a fix correctly.  Here is what I replaced it with.

-- >8 -- cut here -- >8 --
From: Johannes Schindelin <redacted>
Date: Fri, 23 Feb 2007 05:20:32 +0100
Subject: [PATCH] git-diff: fix combined diff

The code forgets that typecast binds tighter than addition, in
other words:

    (cast *)array + i  === ((cast *)array) + i

Signed-off-by: Johannes Schindelin <redacted>
Signed-off-by: Junio C Hamano <redacted>
---
 builtin-diff.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin-diff.c b/builtin-diff.c
index a659020..c387ebb 100644
--- a/builtin-diff.c
+++ b/builtin-diff.c
@@ -192,7 +192,8 @@ static int builtin_diff_combined(struct rev_info *revs,
 	parent = xmalloc(ents * sizeof(*parent));
 	/* Again, the revs are all reverse */
 	for (i = 0; i < ents; i++)
-		hashcpy((unsigned char*)parent + i, ent[ents - 1 - i].item->sha1);
+		hashcpy((unsigned char *)(parent + i),
+			ent[ents - 1 - i].item->sha1);
 	diff_tree_combined(parent[0], parent + 1, ents - 1,
 			   revs->dense_combined_merges, revs);
 	return 0;
-- 
1.5.0.1.619.g04c5c
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help