pack_one_ref(): use write_packed_entry() to do the writing