A sub-Riemannian geodesic problem is essentially a problem of minimizing a Riemannian distance on a manifold when the velocities are subject to linear constraints. Despite its simplicity, the question whether all sub-Riemannian geodesics are smooth/regular remains open for over 30 years. In the talk I will discuss newly-obtained second-order optimality conditions. In particular, I will prove that the class of minimizing abnormal geodesics splits into two subclasses: 2-normal, which are regular, and 2-abnormal, which require the analysis of order higher than two. Familiar Goh conditions of Agrachev-Sarychev follow as a corollary.