refs: allow for_each_replace_ref to handle arbitrary repositories