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

Check if the refspec matches before transforming