libgit2/libgit2 — pull request #2527 by jacquesg (2014-08-17 13:01:25+00:00)
Title: Check if the refspec matches before transforming

So I've managed to produce a crash by calling ```git_refspec_transform``` by not checking ```git_refspec_src_matches``` before-hand (using ```refs/heads/*:refs/remotes/origin/*``` as the refspec, and passing just "master" to the transform).

We should first ensure that the transformation can be applied (```git_refspsec_src_matches```) before attempting the transformation. Sure the user should really perform the check first, however, crashing if the user didn't is not acceptable. We should be setting ```GITERR_INVALID``` for these scenarios.