Re: [PATCH v2] commit: check result of resolve_ref_unsafe

2017-10-20 Thread Andrey Okoshkin
19.10.2017 20:44, Jeff King wrote: On Thu, Oct 19, 2017 at 12:36:50PM +0300, Andrey Okoshkin wrote: Thanks, this looks good to me. One other possible minor improvement: head = resolve_ref_unsafe("HEAD", 0, junk_oid.hash, NULL); + if (!head) + die(_("unable to

Re: [PATCH v2] commit: check result of resolve_ref_unsafe

2017-10-19 Thread Jeff King
On Thu, Oct 19, 2017 at 12:36:50PM +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

[PATCH v2] commit: check result of resolve_ref_unsafe

2017-10-19 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: