Fix Levenshtein distance when sorting ref regexes
When I cherry-picked in this change I rewrote the comparator, and messed up the ordering of the compare for the distance between two regex patterns. We want the most specific first, and that would have a lower distance from the reference name. Bug: issue 650 Change-Id: I25331274a015b33e3be04ec11e3197750801176c CC: Carlos Eduardo Baldacin Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
		@@ -362,7 +362,7 @@ public class RefControl {
 | 
			
		||||
  private final Comparator<String> BY_MOST_SPECIFIC_SORT =
 | 
			
		||||
      new Comparator<String>() {
 | 
			
		||||
        public int compare(final String pattern1, final String pattern2) {
 | 
			
		||||
          int cmp = distance(pattern2) - distance(pattern1);
 | 
			
		||||
          int cmp = distance(pattern1) - distance(pattern2);
 | 
			
		||||
          if (cmp == 0) {
 | 
			
		||||
            boolean p1_finite = finite(pattern1);
 | 
			
		||||
            boolean p2_finite = finite(pattern2);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user