Junio C Hamano [off-list ref] writes:
quoted
quoted
- strbuf_add(dest, src, n);
+ if (0 < n)
+ strbuf_add(dest, src, n);
This check seems unnecessary. strbuf_add can cope fine with !n.
I was primarily interested in catching negatives, and !n was a mere
optimization, but you are correct to point out that negative n at
this point in the codeflow is a BUG().
Actually, let's just lose the conditional. strbuf_add() would catch
and issue an error message when it notices that we fed negative
count anyway ;-).