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.

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

COMMENTS

author: Kaden Henson
date: 2014-03-11 22:53:51.000000000

Uploaded patch set 4.

-------------------------------------
author: Brenden Conley
date: 2014-03-11 22:53:56.000000000

Patch Set 4:

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

-------------------------------------
author: Brenden Conley
date: 2014-03-11 23:08:32.000000000

Patch Set 4: Code-Review-1

Build Unstable 

https://hudson.eclipse.org/egit/job/egit.gerrit/5607/ : UNSTABLE

-------------------------------------
author: Brenden Conley
date: 2014-03-13 22:52:15.000000000

Patch Set 4: -Code-Review

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

-------------------------------------
author: Brenden Conley
date: 2014-03-13 23:10:53.000000000

Patch Set 4: Verified+1

Build Successful 

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

-------------------------------------
author: Jack Yu
date: 2014-03-15 13:29:26.000000000

Patch Set 4: Code-Review+1

(1 comment)

Fixes the issue of duplicate branch names for me, but I would probably change the control flow a bit.

Line:46, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java -> The logic for identical Strings is now spread over 2 places in the method. As an alternative, one could simply put a guard like condition at the beginning of the method to make it easier to read:

if (o1.compareToIgnoreCase(o2)) == 0)
    return 0;

However, I'm not sure if that brings a runtime penalty compared to your version.

Totally unrelated to your change: o1 and o2 should be s1 and s2, or even more descriptive names. :)

-------------------------------------
author: Danika Greer
date: 2014-03-15 13:50:08.000000000

Patch Set 4:

(1 comment)

Line:46, org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/CommonUtils.java -> That would work, but adds one additional comparison for the whole string which can be avoided.

What would you suggestions be for more descriptive names? For compare methods, it's actually easier to read when the names are short.

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