import org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream;\r
import org.apache.commons.compress.compressors.CompressorException;\r
import org.apache.commons.compress.compressors.CompressorStreamFactory;\r
+import org.apache.wicket.util.io.ByteArrayOutputStream;\r
import org.eclipse.jgit.lib.Constants;\r
import org.eclipse.jgit.lib.FileMode;\r
import org.eclipse.jgit.lib.MutableObjectId;\r
}\r
tw.setRecursive(true);\r
MutableObjectId id = new MutableObjectId();\r
- ObjectReader reader = tw.getObjectReader();\r
long modified = commit.getAuthorIdent().getWhen().getTime();\r
while (tw.next()) {\r
FileMode mode = tw.getFileMode(0);\r
}\r
tw.getObjectId(id, 0);\r
\r
- TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString());\r
- entry.setSize(reader.getObjectSize(id, Constants.OBJ_BLOB));\r
- \r
- entry.setMode(mode.getBits());\r
- entry.setModTime(modified);\r
- tos.putArchiveEntry(entry);\r
- \r
- ObjectLoader ldr = repository.open(id);\r
- ldr.copyTo(tos); \r
- tos.closeArchiveEntry();\r
+ ObjectLoader loader = repository.open(id);\r
+ if (FileMode.SYMLINK == mode) {\r
+ TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString(),TarArchiveEntry.LF_SYMLINK);\r
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();\r
+ loader.copyTo(bos);\r
+ entry.setLinkName(bos.toString());\r
+ entry.setModTime(modified);\r
+ tos.putArchiveEntry(entry);\r
+ tos.closeArchiveEntry();\r
+ } else {\r
+ TarArchiveEntry entry = new TarArchiveEntry(tw.getPathString());\r
+ entry.setMode(mode.getBits());\r
+ entry.setModTime(modified);\r
+ entry.setSize(loader.getSize());\r
+ tos.putArchiveEntry(entry); \r
+ loader.copyTo(tos);\r
+ tos.closeArchiveEntry();\r
+ }\r
}\r
tos.finish();\r
tos.close();\r