diff options
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java index 0e3d000d3a..0dacd4dfbf 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RebaseCommand.java @@ -362,7 +362,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { List<RebaseTodoLine> steps = repo.readRebaseTodo( rebaseState.getPath(GIT_REBASE_TODO), false); - if (steps.size() == 0) { + if (steps.isEmpty()) { return finishRebase(walk.parseCommit(repo.resolve(Constants.HEAD)), false); } if (isInteractive()) { @@ -490,7 +490,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { resetSoftToParent(); List<RebaseTodoLine> steps = repo.readRebaseTodo( rebaseState.getPath(GIT_REBASE_TODO), false); - RebaseTodoLine nextStep = steps.size() > 0 ? steps.get(0) : null; + RebaseTodoLine nextStep = steps.isEmpty() ? null : steps.get(0); File messageFixupFile = rebaseState.getFile(MESSAGE_FIXUP); File messageSquashFile = rebaseState.getFile(MESSAGE_SQUASH); if (isSquash && messageFixupFile.exists()) @@ -575,7 +575,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { ObjectId headId = getHead().getObjectId(); // getHead() checks for null assert headId != null; - if (!AnyObjectId.equals(headId, newParents.get(0))) + if (!AnyObjectId.isEqual(headId, newParents.get(0))) checkoutCommit(headId.getName(), newParents.get(0)); // Use the cherry-pick strategy if all non-first parents did not @@ -1083,7 +1083,7 @@ public class RebaseCommand extends GitCommand<RebaseResult> { repo.writeRebaseTodoFile(rebaseState.getPath(GIT_REBASE_TODO), todoLines, false); - if (poppedLines.size() > 0) { + if (!poppedLines.isEmpty()) { repo.writeRebaseTodoFile(rebaseState.getPath(DONE), poppedLines, true); } @@ -1295,13 +1295,8 @@ public class RebaseCommand extends GitCommand<RebaseResult> { } } return newCommit; - } catch (RefAlreadyExistsException e) { - throw new JGitInternalException(e.getMessage(), e); - } catch (RefNotFoundException e) { - throw new JGitInternalException(e.getMessage(), e); - } catch (InvalidRefNameException e) { - throw new JGitInternalException(e.getMessage(), e); - } catch (CheckoutConflictException e) { + } catch (RefAlreadyExistsException | RefNotFoundException + | InvalidRefNameException | CheckoutConflictException e) { throw new JGitInternalException(e.getMessage(), e); } } |