refs.c: add an err argument to repack_without_refs