From 7123cbf470ea2fa39379a4d914f0933063bbbdfe Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Mon, 3 Dec 2012 10:41:25 -0800 Subject: 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 --- org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Archive.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'org.eclipse.jgit.pgm') 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(); -- cgit v1.2.3