@ -54,6 +54,7 @@ import java.util.Map.Entry;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.ListBranchCommand ;
import org.eclipse.jgit.api.ListBranchCommand ;
import org.eclipse.jgit.api.ListBranchCommand.ListMode ;
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.Constants ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectId ;
import org.eclipse.jgit.lib.ObjectReader ;
import org.eclipse.jgit.lib.ObjectReader ;
@ -182,7 +183,8 @@ class Branch extends TextBuiltin {
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
@Override
protected void run ( ) throws Exception {
protected void run ( ) {
try {
if ( delete ! = null | | deleteForce ! = null ) {
if ( delete ! = null | | deleteForce ! = null ) {
if ( delete ! = null ) {
if ( delete ! = null ) {
delete ( delete , false ) ;
delete ( delete , false ) ;
@ -190,7 +192,8 @@ class Branch extends TextBuiltin {
if ( deleteForce ! = null ) {
if ( deleteForce ! = null ) {
delete ( deleteForce , true ) ;
delete ( deleteForce , true ) ;
}
}
} else {
return ;
}
if ( rename ) {
if ( rename ) {
String src , dst ;
String src , dst ;
if ( otherBranch = = null ) {
if ( otherBranch = = null ) {
@ -264,10 +267,12 @@ class Branch extends TextBuiltin {
}
}
list ( ) ;
list ( ) ;
}
}
} catch ( IOException | GitAPIException e ) {
throw die ( e . getMessage ( ) , e ) ;
}
}
}
}
private void list ( ) throws Exception {
private void list ( ) throws IOException , GitAPI Exception {
Ref head = db . exactRef ( Constants . HEAD ) ;
Ref head = db . exactRef ( Constants . HEAD ) ;
// This can happen if HEAD is stillborn
// This can happen if HEAD is stillborn
if ( head ! = null ) {
if ( head ! = null ) {
@ -316,7 +321,7 @@ class Branch extends TextBuiltin {
}
}
private void printHead ( final ObjectReader reader , final String ref ,
private void printHead ( final ObjectReader reader , final String ref ,
final boolean isCurrent , final Ref refObj ) throws Exception {
final boolean isCurrent , final Ref refObj ) throws IO Exception {
outw . print ( isCurrent ? '*' : ' ' ) ;
outw . print ( isCurrent ? '*' : ' ' ) ;
outw . print ( ' ' ) ;
outw . print ( ' ' ) ;
outw . print ( ref ) ;
outw . print ( ref ) ;