@ -51,6 +51,7 @@ import java.util.TreeSet;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.Git ;
import org.eclipse.jgit.api.LsRemoteCommand ;
import org.eclipse.jgit.api.LsRemoteCommand ;
import org.eclipse.jgit.api.errors.GitAPIException ;
import org.eclipse.jgit.lib.AnyObjectId ;
import org.eclipse.jgit.lib.AnyObjectId ;
import org.eclipse.jgit.lib.Ref ;
import org.eclipse.jgit.lib.Ref ;
import org.kohsuke.args4j.Argument ;
import org.kohsuke.args4j.Argument ;
@ -72,7 +73,7 @@ class LsRemote extends TextBuiltin {
/** {@inheritDoc} */
/** {@inheritDoc} */
@Override
@Override
protected void run ( ) throws Exception {
protected void run ( ) {
LsRemoteCommand command = Git . lsRemoteRepository ( ) . setRemote ( remote )
LsRemoteCommand command = Git . lsRemoteRepository ( ) . setRemote ( remote )
. setTimeout ( timeout ) . setHeads ( heads ) . setTags ( tags ) ;
. setTimeout ( timeout ) . setHeads ( heads ) . setTags ( tags ) ;
TreeSet < Ref > refs = new TreeSet < > ( new Comparator < Ref > ( ) {
TreeSet < Ref > refs = new TreeSet < > ( new Comparator < Ref > ( ) {
@ -82,12 +83,16 @@ class LsRemote extends TextBuiltin {
return r1 . getName ( ) . compareTo ( r2 . getName ( ) ) ;
return r1 . getName ( ) . compareTo ( r2 . getName ( ) ) ;
}
}
} ) ;
} ) ;
try {
refs . addAll ( command . call ( ) ) ;
refs . addAll ( command . call ( ) ) ;
for ( Ref r : refs ) {
for ( Ref r : refs ) {
show ( r . getObjectId ( ) , r . getName ( ) ) ;
show ( r . getObjectId ( ) , r . getName ( ) ) ;
if ( r . getPeeledObjectId ( ) ! = null )
if ( r . getPeeledObjectId ( ) ! = null )
show ( r . getPeeledObjectId ( ) , r . getName ( ) + "^{}" ) ; //$NON-NLS-1$
show ( r . getPeeledObjectId ( ) , r . getName ( ) + "^{}" ) ; //$NON-NLS-1$
}
}
} catch ( GitAPIException | IOException e ) {
throw die ( e . getMessage ( ) , e ) ;
}
}
}
/** {@inheritDoc} */
/** {@inheritDoc} */