  We prove a rigidity result for foliations on surfaces of genus two, which can
be seen as a generalization to higher genus of Herman's theorem on circle
diffeomorphisms and, correspondingly, flows on the torus. We prove in
particular that, if a smooth, orientable foliation with non-degenerate (Morse)
singularities on a closed surface of genus two is minimal, then, under a full
measure condition for the rotation number, it is differentiably conjugate to a
linear foliation.
  The corresponding result at the level of Poincar\'e sections is that, for a
full measure set of interval exchange transformations with 4 or 5 continuity
intervals and irreducible combinatorics, any generalized interval exchange
transformation which is topologically conjugate to a IET from this set and
satisfies an obstruction given by a boundary operator is
$\mathcal{C}^1$-conjugate to it. This in particular settles a conjecture by
Marmi, Moussa and Yoccoz in genus two. Our results also show that this
conjecture on the rigidity of GIETs can be reduced to the study of affine IETs,
or more precisely of Birkhoff sums of piecewise constant observables over
standard IETs, in genus $g \geq 3$.
  Our approach is via renormalization, namely we exploit a suitable Oseledets
regular acceleration of the Rauzy-Veech induction on the space of GIETs. For
infinitely renormalizable, irrational GIETs of any number of intervals $d\geq
2$ we prove a dynamical dichotomy on the behaviour of the orbits under
renormalization, by proving that either an orbit is recurrent to certain
bounded sets in the space of GIETs, or it diverges and it is approximated (up
to lower order terms) by the orbit of an affine IET (a case that we refer to as
affine shadowing).
