  We consider the non-equilibrium dynamics of a system of interacting massless
fermions in a ring threaded by a magnetic flux. We focus on the quench where
the flux is initially vanishing and is then turned on. We show that the
definition of the limit of abrupt quench is problematic due to the presence of
gauge invariance that has to be taken into account. We then propose a specific
protocol where the dynamics is non-trivial. Employing techniques coming from
the Algebraic Bethe-Ansatz, we present an exact formula for the Loschmidt echo
valid at all times as a Fredholm determinant at the free fermionic point. From
the analysis of the asymptotic behavior of the Fredholm determinant, we show
that the distribution of work done at small energies present an edge
singularity whose exponent can be explicitly computed. Using the correspondence
between the edge singularity and the decay of the fidelity at finite-size we
propose a general formula for the exponent valid also in the interacting case.
