Re: [PATCH] blame.c: fix garbled error message
- From
Jeff King <peff@peff.net>
- Date
- Jan 12, 2015, 23:12 UTC
- Message-ID
- <20150112231231.GA4023@peff.net>
- In-Reply-To
- <xmqqzj9n623h.fsf@gitster.dls.corp.google.com>
On Mon, Jan 12, 2015 at 02:55:30PM -0800, Junio C Hamano wrote:
Show 6 quoted lines
> With the patch applied on top of 1da1e07c (or the result merged to > 'next' for that matter), I see test breakages in many places "git > blame" is used, e.g. t7010. Did you run the test suite? > > This is because it is perfectly normal for prepare_final() to return > NULL. Unconditionally running xstrdup() would of course fail.
Eek. I even thought of this possibility and checked the prepare_initial callsite, but not the prepare_final one.
As an aside, I have often been tempted to have xstrdup silently propagate a NULL. It would have been the right thing to do here, but maybe there are cases where the segfault is preferable for catching a mistake early (otherwise you might store the NULL and then segfault much later).
-Peff