Thread (3 messages) flat view 3 messages, 3 authors, 2016-06-15

Re: [PATCH] diff-options: add --stat

From: Linus Torvalds <torvalds@osdl.org>
Date: 2016-06-15 22:42:23


On Thu, 13 Apr 2006, Junio C Hamano wrote:
I like what this tries to do (as I already said), but there are
issues with the way it does it; here are some comments.
quoted
+static int fn_diffstat(void *priv, mmbuffer_t *mb, int nbuf)
+{
+...
+	for (i = 0; i < nbuf; i++)
+		if (mb[i].ptr[0] == '+')
+			x->added++;
+		else if (mb[i].ptr[0] == '-')
+			x->deleted++;
+	return 0;
+}
This is broken if you have a hunk that adds, deletes or
leaves a line that happens to begin with a plus or a minus.
I think you can just depend on it being in mb[0].ptr[0], no?

xdiff always gives full lines at a time, afaik, and mb[0] always ends up 
being available.

		Linus
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help