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