Example usage for org.eclipse.jgit.api ArchiveCommand unregisterFormat

List of usage examples for org.eclipse.jgit.api ArchiveCommand unregisterFormat

Introduction

In this page you can find the example usage for org.eclipse.jgit.api ArchiveCommand unregisterFormat.

Prototype

public static void unregisterFormat(String name) 

Source Link

Document

Marks support for an archival format as no longer needed so its Format can be garbage collected if no one else is using it either.

Usage

From source file:com.google.gitiles.ArchiveFormat.java

License:Open Source License

/** Unregister all JGit archive formats supported by Gitiles. */
public static void unregisterAll() {
    for (ArchiveFormat fmt : values()) {
        ArchiveCommand.unregisterFormat(fmt.getRegisteredName());
    }/*from   www  . j  a  va 2 s  .  c o  m*/
}

From source file:edu.nju.cs.inform.jgit.porcelain.CreateCustomFormatArchive.java

License:Apache License

public static void main(String[] args) throws IOException, GitAPIException {
    try (Repository repository = CookbookHelper.openJGitCookbookRepository()) {
        File file = File.createTempFile("test", ".mzip");
        // make the archive format known
        ArchiveCommand.registerFormat("myzip", new ZipArchiveFormat());
        try {//from  www.  j  a  v a  2s.co m
            // this is the file that we write the archive to
            try (OutputStream out = new FileOutputStream(file)) {
                // finally call the ArchiveCommand to write out using the given format
                try (Git git = new Git(repository)) {
                    git.archive().setTree(repository.resolve("master")).setFormat("myzip").setOutputStream(out)
                            .call();
                }
            }
        } finally {
            ArchiveCommand.unregisterFormat("myzip");
        }

        System.out.println("Wrote " + file.length() + " bytes to " + file);
    }
}