write_ref_sha1(): remove check for lock == NULL