Improve Repository#branches_contains performance