Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Andrey Okoshkin
I also think it's a good idea to record the destination of the updated symref. But for now the most simple solution is just to catch the unreadable HEAD error. Maybe for the future improvement it would be nice to redesign print_summary passing some ref_transaction results to it. 19.10.2017 05:49,

Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-18 Thread Jeff King
On Thu, Oct 19, 2017 at 09:41:29AM +0900, Junio C Hamano wrote: > Jeff King writes: > > > Tangential to your patch, I also wondered why we did not pass > > RESOLVE_REF_READING to resolve_ref_unsafe(). I think the answer is that > > for symref lookups, we normally don't pass it so that we can han

Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-18 Thread Junio C Hamano
Jeff King writes: > Tangential to your patch, I also wondered why we did not pass > RESOLVE_REF_READING to resolve_ref_unsafe(). I think the answer is that > for symref lookups, we normally don't pass it so that we can handle > dangling symrefs. Of course we _just_ wrote HEAD ourselves, so we'd >

Re: [PATCH] commit: check result of resolve_ref_unsafe

2017-10-18 Thread Jeff King
On Wed, Oct 18, 2017 at 08:00:43PM +0300, Andrey Okoshkin wrote: > 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

[PATCH] commit: check result of resolve_ref_unsafe

2017-10-18 Thread Andrey Okoshkin
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 Oko