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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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.
> 
> > +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
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]