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

Re: [PATCH] Add the --submodule-summary option to the diff option family

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 5, 2009, 09:20 UTC
Message-ID
<alpine.DEB.1.00.0910051119260.4985@pacific.mpi-cbg.de>
In-Reply-To
<4AC9B7C3.3090302@viscovery.net>
Hi,
On Mon, 5 Oct 2009, Johannes Sixt wrote:
Show 36 quoted lines
> Johannes Schindelin schrieb:
> > On Mon, 5 Oct 2009, Johannes Sixt wrote:
> >> Junio C Hamano schrieb:
> >>> Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> >>>> +	fwrite(sb.buf, sb.len, 1, f);
> >>>> +
> >>>> +	if (!message) {
> >>>> +		while ((commit = get_revision(&rev))) {
> >>>> +			strbuf_setlen(&sb, 0);
> >>>> +			if (del)
> >>>> +				strbuf_addstr(&sb, commit->object.flags &
> >>>> +						SYMMETRIC_LEFT ? del : add);
> >>>> +			format_commit_message(commit, format, &sb,
> >>>> +					rev.date_mode);
> >>>> +			if (del)
> >>>> +				strbuf_addstr(&sb, reset);
> >>>> +			strbuf_addch(&sb, '\n');
> >>>> +			fwrite(sb.buf, sb.len, 1, f);
> >> Outch! fwrite doesn't interpret color escapes. AFAICS, this sequence is
> >> easy to change such that it uses fprintf().
> > 
> > Good point.  I changed it to
> > 
> >                         fprintf(f, "%s", sb.buf);
> 
> Thanks. But notice how you are constructing the string in sb from pieces.
> I meant to change it to
> 
> 	fprintf(f, "%s%s%s\n",
> 			del ? (commit->object.flags & SYMMETRIC_LEFT
> 					 ? del : add) : "",
> 			format_commit_message(commit, format, &sb,
> 					rev.date_mode),
> 			del ? reset : "");
> 
> or similar. We already use this idiom elsewhere.

And I find it utterly ugly and unreadable there, too. So this is why I did not do it.

Ciao, Dscho

Previous: Johannes SixtNext: Johannes Schindelin
Message 6 of 20 in “Add the --submodule-summary option to the diff option family”
  1. Add the --submodule-summary option to the diff option familyJohannes Schindelin, Oct 4, 2009
  2. Junio C HamanoOct 4, 2009
  3. Johannes SixtOct 5, 2009
  4. Johannes SchindelinOct 5, 2009
  5. Johannes SixtOct 5, 2009
  6. Johannes SchindelinOct 5, 2009
  7. Johannes SchindelinOct 5, 2009
  8. Jens LehmannOct 5, 2009
  9. Jens LehmannOct 5, 2009
  10. Johannes SchindelinOct 5, 2009
  11. Junio C HamanoOct 5, 2009
  12. Johannes SchindelinOct 5, 2009
  13. Jens LehmannOct 6, 2009
  14. Junio C HamanoOct 6, 2009
  15. Johannes SchindelinOct 6, 2009
  16. Jens LehmannOct 6, 2009
  17. Johannes SchindelinOct 6, 2009
  18. Jens LehmannOct 7, 2009
  19. Junio C HamanoOct 7, 2009
  20. Johannes SchindelinOct 7, 2009

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.