diff options
author | Jonathan Nieder <jrn@google.com> | 2013-12-17 11:22:46 -0800 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2013-12-17 11:22:46 -0800 |
commit | f2abbd0ea99aed638ca098e336f60f52bc923237 (patch) | |
tree | f35a719bc3f26b8c80a21135d443625608ad088b /org.eclipse.jgit.pgm/src/org/eclipse | |
parent | aad7dee3ef492e9333581e8d6b2269dc091ea1d2 (diff) | |
download | jgit-f2abbd0ea99aed638ca098e336f60f52bc923237.tar.gz jgit-f2abbd0ea99aed638ca098e336f60f52bc923237.zip |
archive: Prepend a specified prefix to all entry filenames
Common practice when distributing tarballs is to prefix all entries
with a single directory name so when the tarball is extracted it all
falls neatly into a single directory. Add a setPrefix() method to
ArchiveCommand to support this.
Change-Id: I16b2832ef98c30977f6b77b646728b83d93c196f
Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.pgm/src/org/eclipse')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java | 4 | ||||
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java | 1 |
2 files changed, 5 insertions, 0 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 7b88a94345..80bb9ec9df 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 @@ -69,6 +69,9 @@ class Archive extends TextBuiltin { @Option(name = "--format", metaVar = "metaVar_archiveFormat", usage = "usage_archiveFormat") private String format; + @Option(name = "--prefix", metaVar = "metaVar_archivePrefix", usage = "usage_archivePrefix") + private String prefix; + @Option(name = "--output", aliases = { "-o" }, metaVar = "metaVar_file", usage = "usage_archiveOutput") private String output; @@ -88,6 +91,7 @@ class Archive extends TextBuiltin { ArchiveCommand cmd = new Git(db).archive() .setTree(tree) .setFormat(format) + .setPrefix(prefix) .setOutputStream(stream); if (output != null) cmd.setFilename(output); diff --git a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java index a51313ae1e..c42e5fb59d 100644 --- a/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java +++ b/org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/internal/CLIText.java @@ -143,6 +143,7 @@ public class CLIText extends TranslationBundle { /***/ public String mergeWentWellStoppedBeforeCommitting; /***/ public String metaVar_KEY; /***/ public String metaVar_archiveFormat; + /***/ public String metaVar_archivePrefix; /***/ public String metaVar_arg; /***/ public String metaVar_author; /***/ public String metaVar_bucket; |