From: Junio C Hamano Date: Mon, 16 Jul 2007 17:50:30 GMT Subject: Re: [PATCH] Add --show-size to git log to print message size Message-ID: <7v4pk444rd.fsf@assigned-by-dhcp.cox.net> In-Reply-To: <81b0412b0707160531mad35ed4x4c89b2d6c6f5f707@mail.gmail.com> "Alex Riesen" writes: > On 7/16/07, Marco Costalba wrote: >> Currently the patch just include the log message because the diff >> content (-p option) is not buffered but is written with a combination >> of printf, puts, fputs, fwrite and putchar directly to stdout. >> >> My question is, there is a way to get the quantity of bytes written to >> stdout before they are printed? I'm not an expert of C stdio library, >> so perhaps this is nonsense, but I was thinking of reading the size of >> stout buffer before to fflush() (I don't know if it is possible). > > It is not possible. Buffers can be flushed at any time (i.e. they are > flushed when EOL reached and the output is a terminal for stdout). > > It is also a bit unclear _why_ do you need the diff output. You don't > show it immediately anyway. I'd say making --show-message-size option incompatible with diff output would be good enough futureproofing for now.