• Yorick Peterse's avatar
    Fixed ordering in Project.find_with_namespace · 42598786
    Yorick Peterse authored
    This ensures that Project.find_with_namespace returns a row matching
    literally as the first value, instead of returning a random value.
    
    The ordering here is _only_ applied to Project.find_with_namespace and
    _not_ Project.where_paths_in as currently there's no code that requires
    Project.where_paths_in to return rows in a certain order. Since this
    method also returns all rows that match there's no real harm in not
    setting a specific order either. Another reason is that generating all
    the "WHEN" arms for multiple values in Project.where_paths_in becomes
    really messy.
    
    On MySQL we have to use the "BINARY" operator to turn a "WHERE" into a
    case-sensitive WHERE as otherwise MySQL may still end up returning rows
    in an unpredictable order.
    
    Fixes gitlab-org/gitlab-ce#18603
    42598786
project.rb 31.8 KB