Browse Source

GC: Simplify reference equals() method

Signed-off-by: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: I5b2e12e012d5423e9b84c1c66a478960121ea212
stable-4.11
Hector Caballero 7 years ago
parent
commit
e00a12f5a2
  1. 15
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java

15
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());
}
/**

Loading…
Cancel
Save