test-ref-store: avoid passing NULL to printf
commitcc61cf465f7777d0aebd1a35ca72650fef8f253f
authorJeff King <peff@peff.net>
Thu, 19 Oct 2017 17:46:21 +0000 (19 13:46 -0400)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 Oct 2017 12:29:00 +0000 (21 21:29 +0900)
treed40fd073b1eebc883e95b15a7b3fc052770a4fc9
parent4843cdefe3f30d19c1b2cf601522152c1413459a
test-ref-store: avoid passing NULL to printf

It's possible for resolve_ref_unsafe() to return NULL (e.g.,
if we are reading and the ref does not exist), in which case
we'll pass NULL to printf. On glibc systems this produces
"(null)", but on others it may segfault.

The tests don't expect any such case, but if we ever did
trigger this, we would prefer to cleanly fail the test with
unexpected input rather than segfault. Let's manually
replace NULL with "(null)". The exact value doesn't matter,
as it won't match any possible ref the caller could expect
(and anyway, the exit code of the program will tell whether
"ref" is valid or not).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/helper/test-ref-store.c