import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.ListBranchCommand;
import org.eclipse.jgit.api.ListBranchCommand.ListMode;
+import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectReader;
/** {@inheritDoc} */
@Override
- protected void run() throws Exception {
- if (delete != null || deleteForce != null) {
- if (delete != null) {
- delete(delete, false);
- }
- if (deleteForce != null) {
- delete(deleteForce, true);
+ protected void run() {
+ try {
+ if (delete != null || deleteForce != null) {
+ if (delete != null) {
+ delete(delete, false);
+ }
+ if (deleteForce != null) {
+ delete(deleteForce, true);
+ }
+ return;
}
- } else {
if (rename) {
String src, dst;
if (otherBranch == null) {
}
list();
}
+ } catch (IOException | GitAPIException e) {
+ throw die(e.getMessage(), e);
}
}
- private void list() throws Exception {
+ private void list() throws IOException, GitAPIException {
Ref head = db.exactRef(Constants.HEAD);
// This can happen if HEAD is stillborn
if (head != null) {
}
private void printHead(final ObjectReader reader, final String ref,
- final boolean isCurrent, final Ref refObj) throws Exception {
+ final boolean isCurrent, final Ref refObj) throws IOException {
outw.print(isCurrent ? '*' : ' ');
outw.print(' ');
outw.print(ref);