xdiff/xpatience: factor out fall-back-diff function