Java 类org.eclipse.jgit.api.errors.DetachedHeadException 实例源码

项目:PhET    文件:PullAll.java   
private static void visit( File directory ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    for ( final File child : directory.listFiles() ) {
        if ( child.isDirectory() ) {
            visit( child );
        }
        final String name = child.getName();
        if ( name.equals( ".git" ) ) {

            Thread t = new Thread( new Runnable() {
                public void run() {
                    try {
                        Git git = Git.open( child.getParentFile() );
                        PullResult pullResult = git.pull().call();
                        System.out.println( "pulled on " + child.getParentFile().getName() + ", pullResult = " + pullResult.isSuccessful() + ", " + pullResult.getFetchedFrom() + ", fetch messages: " + pullResult.getFetchResult().getMessages() );
                    }
                    catch ( Exception e ) {
                        e.printStackTrace();
                    }
                }
            } );
            t.start();

        }
    }
}
项目:wagon-git    文件:BrokenGitProviderTest.java   
@Test(expected = TransferFailedException.class)
public void testGitApiException() throws Exception {

    new AbstractGitWagon() {

        @Override
        protected GitUri buildGitUri(final URI gitUri) throws IOException,
            URISyntaxException {

            final String branchName = gitUri.getQuery();
            final String asciiUriString = gitUri.toASCIIString();
            final String gitRepositoryUri = asciiUriString.substring(0, asciiUriString.indexOf('?'));
            final String resource = gitUri.getFragment();
            return new GitUri(gitRepositoryUri, branchName, resource);
        }

        @Override
        protected File getFileForResource(final String resourceName) throws GitAPIException,
            IOException,
            URISyntaxException {

            throw new DetachedHeadException();
        }
    }.resourceExists("fail");
}
项目:ivy-pdi-git-steps    文件:PullGitCommand.java   
public Git call(final GitOperationsStep gitOperationsStep, Git git,
    CredentialsProvider cp, String gitRepoUrl, File gitRepoFolder)
    throws IllegalArgumentException, IOException,
    WrongRepositoryStateException, InvalidConfigurationException,
    DetachedHeadException, InvalidRemoteException, CanceledException,
    RefNotFoundException, NoHeadException, TransportException,
    GitAPIException {
  git.pull().setCredentialsProvider(cp).setRebase(rebase).call();
  return git;
}
项目:PhET    文件:PullAll.java   
public static void main( String[] args ) throws IOException, RefNotFoundException, DetachedHeadException, WrongRepositoryStateException, InvalidRemoteException, InvalidConfigurationException, CanceledException {
    visit( new File( "C:\\workingcopy\\phet-little-gits" ) );
}