]> source.dussan.org Git - jgit.git/commitdiff
GC: Simplify reference equals() method 83/116783/1
authorHector Caballero <hector.caballero@ericsson.com>
Tue, 30 Jan 2018 01:51:14 +0000 (20:51 -0500)
committerHector Caballero <hector.caballero@ericsson.com>
Tue, 6 Feb 2018 11:26:14 +0000 (06:26 -0500)
Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: I5b2e12e012d5423e9b84c1c66a478960121ea212

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

index d921bc89ec716c65f4eca16a7e7cb69d6a814da1..2be38b980ee8816832f264c53fba99fdb3ab35c5 100644 (file)
@@ -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());
        }
 
        /**