Re: [PATCH v4] commit: check result of resolve_ref_unsafe
- From
Jeff King <peff@peff.net>
- Date
- Oct 21, 2017, 06:19 UTC
- Message-ID
- <20171021061921.xtocfdfik6ehhwzw@sigill.intra.peff.net>
- In-Reply-To
- <a9cce39c-e432-d5a7-d9ad-6b67d9e04d23@samsung.com>
On Fri, Oct 20, 2017 at 04:09:30PM +0300, Andrey Okoshkin wrote:
Show 13 quoted lines
> Add check of the resolved HEAD reference while printing of a commit summary. > resolve_ref_unsafe() may return NULL pointer if underlying calls of lstat() or > open() fail in files_read_raw_ref(). > Such situation can be caused by race: file becomes inaccessible to this moment. > > Signed-off-by: Andrey Okoshkin <a.okoshkin@samsung.com> > --- > Hello, > I think this way is better for user experience: > * git doesn't crash; > * warning is shown; > * commit has been successfully created then it's safe to show a summary message > with already known information and without resolved HEAD.
I'm on the fence between this and the die_errno() version. Given that this would basically never happen in practice, I don't think it matters too much. And that makes me want to just err on the side of simplicity. But it's not like this is all that complex, either.
-Peff