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 | |
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')
3 files changed, 7 insertions, 0 deletions
diff --git a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties index d23f378993..1d2a8971f7 100644 --- a/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties +++ b/org.eclipse.jgit.pgm/resources/org/eclipse/jgit/pgm/internal/CLIText.properties @@ -74,6 +74,7 @@ mergeWentWellStoppedBeforeCommitting=Automatic merge went well; stopped before c metaVar_DAG=DAG metaVar_KEY=KEY metaVar_archiveFormat=format +metaVar_archivePrefix=prefix/ metaVar_arg=ARG metaVar_author=AUTHOR metaVar_base=base @@ -229,6 +230,7 @@ usage_approveDestructionOfRepository=approve destruction of repository usage_archive=zip up files from the named tree usage_archiveFormat=archive format. Currently supported formats: 'tar', 'zip', 'tgz', 'tbz2', 'txz' usage_archiveOutput=output file to write the archive to +usage_archivePrefix=string to prepend to each pathname in the archive usage_blameLongRevision=show long revision usage_blameRange=annotate only the given range usage_blameRawTimestamp=show raw timestamp 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; |