Merge pull request #2527 from jacquesg/refspec-crash Check if the refspec matches before transforming