refs.c: make prune_ref use a transaction to delete the ref