Example usage for org.eclipse.jgit.api Git archive

List of usage examples for org.eclipse.jgit.api Git archive

Introduction

In this page you can find the example usage for org.eclipse.jgit.api Git archive.

Prototype

public ArchiveCommand archive() 

Source Link

Document

Return a command to create an archive from a tree

Usage

From source file:org.jenkinsci.plugins.os_ci.utils.GitClient.java

License:Apache License

public static void archive() throws GitAPIException {
    String localPath, remotePath;
    Repository localRepo;/*from   w  ww .  j a  v  a2s . co m*/
    Git git;

    try {
        localPath = "C:\\Users\\agrosmar\\git\\gitTry";
        //            remotePath = "git@github.com:me/mytestrepo.git";
        localRepo = new FileRepository(localPath + "/.git");
        git = new Git(localRepo);
        //            "http://gitlab.cisco.com/control-plane-ci/deployment-scripts/blob/master/GLOBAL

        FileOutputStream out = new FileOutputStream(new File("c://git.zip"));
        git.archive().setTree(localRepo.resolve("")).setFormat("zip").setOutputStream(out).call();

    } catch (Exception e) {
        e.printStackTrace();
    }
    //        ObjectId tree = null;

}