commit: check result of resolve_ref_unsafe
commitc26de08370ad5d927d93dbe6fb46103caabb889c
authorAndrey Okoshkin <a.okoshkin@samsung.com>
Fri, 20 Oct 2017 11:03:28 +0000 (20 14:03 +0300)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Oct 2017 12:23:44 +0000 (21 21:23 +0900)
tree3b500a2666d4989d0a46a9bbfeb18974878ac695
parent4c2224e83951a685185bb8c1f83b28e22fee0e27
commit: check result of resolve_ref_unsafe

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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c