Moves the check from inside the loop to outside the loop
and returns immediately if the HEAD advertisded ref is null
Change-Id: I539da6cafb4f73610b8e00259e32bd4d57f4f4cc
}
private Ref findBranchToCheckout(FetchResult result) {
- Ref foundBranch = null;
final Ref idHEAD = result.getAdvertisedRef(Constants.HEAD);
+ if (idHEAD == null)
+ return null;
+ Ref foundBranch = null;
for (final Ref r : result.getAdvertisedRefs()) {
final String n = r.getName();
if (!n.startsWith(Constants.R_HEADS))
continue;
- if (idHEAD == null)
- continue;
if (r.getObjectId().equals(idHEAD.getObjectId())) {
foundBranch = r;
break;