On Wed, Jun 11, 2014 at 04:28:26PM -0400, Konstantin Ryabitsev wrote:
> On 11/06/14 04:01 PM, John Keeping wrote:
> > Since the "html" functions use raw write(2) to STDIO_FILENO, we don't
> > notice problems with most pages, but raw patches write using printf(3).
> > This is fine if we're outputting straight to stdout since the buffers
> > are flushed on exit, but we close the cache output before this, so the
> > cached output ends up being truncated.

Actually, it's slightly more interesting than this... since we don't set
GIT_FLUSH, Git decides whether or not it will flush stdout after writing
each commit based on whether or not stdout points to a regular file (in
maybe_flush_or_die()).

Which means that when writing directly to the webserver, Git flushes
stdout for us, but when we redirect stdout to the cache it points to a
regular file so Git no longer flushes the output for us.

The patch is still correct, but perhaps the full explanation is
interesting!
_______________________________________________
CGit mailing list
CGit@lists.zx2c4.com
http://lists.zx2c4.com/mailman/listinfo/cgit

Reply via email to