diff options
author | Jonathan Nieder <jrn@google.com> | 2013-06-06 12:31:46 -0700 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2013-06-06 12:31:46 -0700 |
commit | ebfe85d0374aee1992d01029c12338da3d67e26b (patch) | |
tree | 0ac7973cd1da34edfa62e3edccf9642b29126802 /org.eclipse.jgit.archive/src | |
parent | ed5199f63b090063e07b19c8651bbfc484361462 (diff) | |
download | jgit-ebfe85d0374aee1992d01029c12338da3d67e26b.tar.gz jgit-ebfe85d0374aee1992d01029c12338da3d67e26b.zip |
Add long filename, large file, and non-ASCII filename support to TarFormat
Attempts to write entries with too-long filenames currently error out:
$ jgit.pgm/target/jgit archive HEAD >test.tar
java.lang.RuntimeException: file name 'org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/resolver/DefaultReceivePackFactory.java' is too long ( > 100 bytes)
at org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.putArchiveEntry(TarArchiveOutputStream.java:288)
at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:92)
at org.eclipse.jgit.archive.TarFormat.putEntry(TarFormat.java:62)
at org.eclipse.jgit.api.ArchiveCommand.writeArchive(ArchiveCommand.java:293)
at org.eclipse.jgit.api.ArchiveCommand.call(ArchiveCommand.java:322)
at org.eclipse.jgit.pgm.Archive.run(Archive.java:97)
at org.eclipse.jgit.pgm.TextBuiltin.execute(TextBuiltin.java:174)
at org.eclipse.jgit.pgm.Main.execute(Main.java:213)
at org.eclipse.jgit.pgm.Main.run(Main.java:121)
at org.eclipse.jgit.pgm.Main.main(Main.java:95)
That's because the default longFileMode is LONGFILE_ERROR, which
throws an exception for filenames longer than 100 characters. Switch
to LONGFILE_POSIX. While at it, handle large files and filenames with
strange encodings, too.
This requires commons compress 1.4, which introduced support for large
files and POSIX long filenames.
Change-Id: I04d5427eec0968b129f55d7a4c6021039a494828
Diffstat (limited to 'org.eclipse.jgit.archive/src')
-rw-r--r-- | org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java index 3b27489e26..228de7c379 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java @@ -54,11 +54,14 @@ import org.eclipse.jgit.lib.FileMode; import org.eclipse.jgit.lib.ObjectLoader; /** - * Unix TAR format (ustar + old GNU long filename extension). + * Unix TAR format (ustar + some PAX extensions). */ public class TarFormat implements ArchiveCommand.Format<ArchiveOutputStream> { public ArchiveOutputStream createArchiveOutputStream(OutputStream s) { - return new TarArchiveOutputStream(s); + TarArchiveOutputStream out = new TarArchiveOutputStream(s, "UTF-8"); //$NON-NLS-1$ + out.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); + out.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); + return out; } public void putEntry(ArchiveOutputStream out, |