DESCRIPTION

Fix CommonUtils.STRING_ASCENDING_COMPARATOR for equal strings

Equal strings resulted in -1, but should return 0. The same applies when
comparing two empty strings. Non-equal strings now always result in a
non-zero return value.

This became apparent since the Switch-To menu uses this comparator now
(https://git.eclipse.org/r/#/c/22911/). This results in duplicated menu
entries, e.g. if a branch appears in the reflog too.

Change-Id: I9ba316e9eb078b4f97c8c9e9d9749aadea0b5068
Signed-off-by: Kaden Henson xxx@xxx.xxx
Signed-off-by: Danika Greer xxx@xxx.xxx


COMMENTS

author: Kaden Henson
date: 2014-03-15 14:53:17.000000000

Uploaded patch set 7.

-------------------------------------
author: Brenden Conley
date: 2014-03-15 14:53:22.000000000

Patch Set 7:

Build Started https://hudson.eclipse.org/egit/job/egit.gerrit/5616/

-------------------------------------
author: Kaden Henson
date: 2014-03-15 14:58:00.000000000

Patch Set 7:

I changed the comparator to return zero only if both strings are equal. If they differ in case, leading zeros or otherwise, a non-zero value is returned.

-------------------------------------
author: Brenden Conley
date: 2014-03-15 15:07:37.000000000

Patch Set 7: Verified+1

Build Successful 

https://hudson.eclipse.org/egit/job/egit.gerrit/5616/ : SUCCESS

-------------------------------------
author: Danika Greer
date: 2014-03-15 15:10:07.000000000

Patch Set 7:

Ok, that's the other way :). Could you add the following to assertSortedLike and make sure that the callers pass unique Strings?:

		TreeSet<String> sortedSet = new TreeSet<String>(
				CommonUtils.STRING_ASCENDING_COMPARATOR);
		sortedSet.addAll(expected);
		assertEquals(expected, new ArrayList<String>(sortedSet));

-------------------------------------
