diff options
author | Jonathan Nieder <jrn@google.com> | 2012-12-03 10:41:25 -0800 |
---|---|---|
committer | Jonathan Nieder <jrn@google.com> | 2012-12-04 15:34:07 -0800 |
commit | 7123cbf470ea2fa39379a4d914f0933063bbbdfe (patch) | |
tree | 06201abf5ffdd5af283eec23d12983760912eb6c /org.eclipse.jgit.pgm | |
parent | 72ee3280e08ef9d4a99466f0dbd29f419b5445b7 (diff) | |
download | jgit-7123cbf470ea2fa39379a4d914f0933063bbbdfe.tar.gz jgit-7123cbf470ea2fa39379a4d914f0933063bbbdfe.zip |
archive: Record executable and symlink bits
Setting the mode for a zip entry is now as simple as
"entry.setUnixMode(mode)", so do that.
The test checks using the system's "zipinfo" command (from InfoZIP)
that the mode has been recorded correctly on systems that happen to
have a "zipinfo" command, using org.junit.Assume to distinguish them.
Change-Id: I4236c102fd76f18d01b2dc926eeb9b9fa11a61b7
Diffstat (limited to 'org.eclipse.jgit.pgm')
-rw-r--r-- | org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java | 14 |
1 files changed, 10 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 ec937a3cc3..cc2f287b2a 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 @@ -90,14 +90,20 @@ class Archive extends TextBuiltin { final ZipArchiveEntry entry = new ZipArchiveEntry(name); final ObjectLoader loader = reader.open(idBuf); entry.setSize(loader.getSize()); - out.putArchiveEntry(entry); - loader.copyTo(out); - out.closeArchiveEntry(); - if (mode != FileMode.REGULAR_FILE) + if (mode == FileMode.REGULAR_FILE) + ; // ok + else if (mode == FileMode.EXECUTABLE_FILE || + mode == FileMode.SYMLINK) + entry.setUnixMode(mode.getBits()); + else System.err.println(MessageFormat.format( // CLIText.get().archiveEntryModeIgnored, // name)); + + out.putArchiveEntry(entry); + loader.copyTo(out); + out.closeArchiveEntry(); } out.close(); |