git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Linus Torvalds <torvalds@osdl.org>
Date
Apr 13, 2006, 18:39 UTC
Message-ID
<Pine.LNX.4.64.0604131138080.14565@g5.osdl.org>
In-Reply-To
<7v64ld2uyv.fsf@assigned-by-dhcp.cox.net>
On Thu, 13 Apr 2006, Junio C Hamano wrote:
Show 17 quoted lines
> 
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 10 of 13 in “diff-options: add --stat”
  1. diff-options: add --statJohannes Schindelin, Apr 13, 2006
  2. Johannes SchindelinApr 13, 2006
  3. Johannes SchindelinApr 13, 2006
  4. Junio C HamanoApr 13, 2006
  5. Junio C HamanoApr 13, 2006
  6. Johannes SchindelinApr 13, 2006
  7. Marco CostalbaApr 13, 2006
  8. Johannes SchindelinApr 13, 2006
  9. Junio C HamanoApr 13, 2006
  10. Linus TorvaldsApr 13, 2006
  11. Junio C HamanoApr 13, 2006
  12. Linus TorvaldsApr 13, 2006
  13. Johannes SchindelinApr 13, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.