From e00a12f5a2c6113c6dcf15fd19addb3d053ccfc2 Mon Sep 17 00:00:00 2001 From: Hector Caballero Date: Mon, 29 Jan 2018 20:51:14 -0500 Subject: [PATCH] GC: Simplify reference equals() method Signed-off-by: Hector Oswaldo Caballero Change-Id: I5b2e12e012d5423e9b84c1c66a478960121ea212 --- .../eclipse/jgit/internal/storage/file/GC.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java index d921bc89ec..2be38b980e 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java @@ -768,18 +768,15 @@ public class GC { } private static boolean equals(Ref r1, Ref r2) { - if (r1 == null || r2 == null) + if (r1 == null || r2 == null) { return false; + } if (r1.isSymbolic()) { - if (!r2.isSymbolic()) - return false; - return r1.getTarget().getName().equals(r2.getTarget().getName()); - } else { - if (r2.isSymbolic()) { - return false; - } - return Objects.equals(r1.getObjectId(), r2.getObjectId()); + return r2.isSymbolic() && r1.getTarget().getName() + .equals(r2.getTarget().getName()); } + return !r2.isSymbolic() + && Objects.equals(r1.getObjectId(), r2.getObjectId()); } /** -- 2.39.5