diff options
author | Jonathan Nieder <jrn@google.com> | 2013-05-28 16:51:32 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2013-05-28 16:51:32 -0700 |
commit | 68d92182e6ce177c4ee97bab470ae867997a5530 (patch) | |
tree | fa651f097a677c0f5a3bfaa18c91e35883c7f511 /org.eclipse.jgit.pgm | |
parent | f99fa9d23e93fdd34124e2100d629680894477d7 (diff) | |
download | jgit-68d92182e6ce177c4ee97bab470ae867997a5530.tar.gz jgit-68d92182e6ce177c4ee97bab470ae867997a5530.zip |
Maintain list of archive formats in one place
Add a static start() method to FormatActivator to allow outside
classes such as the Archive subcommand of the jgit program to use it
without a BundleContext. This way, the list of formats only has to be
maintained in one place.
While at it, build a list of registered formats at start() time, so
stop() doesn't have to repeat the same list of formats.
Suggested-by: Shawn Pearce <spearce@spearce.org>
Change-Id: I55cb3095043568740880cc9e4f7cde05f49c363c
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java index 9aa09b4648..62341a93bd 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java @@ -46,8 +46,7 @@ package org.eclipse.jgit.pgm; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.errors.GitAPIException; -import org.eclipse.jgit.archive.TarFormat; -import org.eclipse.jgit.archive.ZipFormat; +import org.eclipse.jgit.archive.FormatActivator; import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.pgm.TextBuiltin; import org.eclipse.jgit.pgm.internal.CLIText; @@ -57,8 +56,7 @@ import org.kohsuke.args4j.Option; @Command(common = true, usage = "usage_archive") class Archive extends TextBuiltin { static { - ArchiveCommand.registerFormat("tar", new TarFormat()); - ArchiveCommand.registerFormat("zip", new ZipFormat()); + FormatActivator.start(); } @Argument(index = 0, metaVar = "metaVar_treeish") |