update-ref.c: extract a new function, parse_next_sha1()