Only compare branches as versions in the policy to sort packages, but not in the solver, fixes #1817

To make this mergeable we still need:

- review from @naderman 
- confirmation from @lsmith77 that it fixes his issue (please try with a git install of composer see if it works for you without your patched up repos)