On Mon, 25 Jun 2007, Jim Meyering wrote:
Remember: I'm trying to improve existing code here.
You should save some of your ire for the person who wrote that code.
Ehh. Remind me who I should be pissed at when the old code was _better_
before your change?
With the current git.c, we report write errors quite well. We don't give
the exact output you want, but on a scale of 1-10, how important is that?
Pretty damn low on the list.
And the reason I'm really really irritated at you is that you ignore me
when I tell you what your bugs are.
- I *told* you that EPIPE is special. What did you do? Ignore my advice,
and made a broken patch that did exactly the opposite of what I told
you.
- And I *told* you that you shouldn't care about errno for stdio, because
stdio was broken. What did you do? You again ignored my advice, and
made _another_ broken patch, exactly the _opposite_ of what I told you.
If you really really *must* get that ENOSPC error string output, create a
helper function like
void flush_or_die(FILE *f, const char *desc)
{
if (ferror(f))
die("write failure on %s", desc)
if (fflush(f)) {
if (errno == EPIPE)
exit(0);
die("write failure on %s: %s",
desc, strerror(errno));
}
}
and then you can start adding calls to "flush_or_die()" to appropriate
places. You could replace the "fflush()" in builtin-rev-list.c with a
"flush_or_die()".
And then you could add a call to "log_tree_commit()" (in log-tree.c), and
that would probably be an improvement too (especially if we start having
things like gitk parse "git log" output, and try to deprecate the old
really low-level plumbing a bit).
Linus