checkout.c: use ref_exists instead of file_exist