summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorNaoki Takezoe <takezoe@gmail.com>2016-12-29 13:47:17 +0900
committerMatthias Sohn <matthias.sohn@sap.com>2017-02-18 10:47:27 +0100
commit1448ec37f9141d16da28151289e3d590c89fc739 (patch)
treefa9e8078b2e8bc9fc536e32c7fc0db5c303322f7 /org.eclipse.jgit
parentd3962fef6b9736c416c14dbb12b54c0a4a269763 (diff)
downloadjgit-1448ec37f9141d16da28151289e3d590c89fc739.tar.gz
jgit-1448ec37f9141d16da28151289e3d590c89fc739.zip
Set commit time to ZipArchiveEntry
Archived zip files for a same commit have different MD5 hash because mdate and mdate in the header of zip entries are not specified. In this case, Commons Compress sets an archived time. In the original git implementation, it's set a commit time: https://github.com/git/git/blob/e2b2d6a172b76d44cb7b1ddb12ea5bfac9613a44/archive.c#L378 By this fix, archive command sets the commit time to ZipArchiveEntry when RevCommit is given as an archiving target. Change-Id: I30dd8710e910cdf42d57742f8709e9803930a123 Signed-off-by: Naoki Takezoe <takezoe@gmail.com> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/.settings/.api_filters8
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java37
2 files changed, 40 insertions, 5 deletions
diff --git a/org.eclipse.jgit/.settings/.api_filters b/org.eclipse.jgit/.settings/.api_filters
index fa8a9cf9a8..418fed6127 100644
--- a/org.eclipse.jgit/.settings/.api_filters
+++ b/org.eclipse.jgit/.settings/.api_filters
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.jgit" version="2">
+ <resource path="src/org/eclipse/jgit/api/ArchiveCommand.java" type="org.eclipse.jgit.api.ArchiveCommand$Format">
+ <filter comment="OSGi semver allows to break implementors in minor releases" id="403804204">
+ <message_arguments>
+ <message_argument value="org.eclipse.jgit.api.ArchiveCommand.Format"/>
+ <message_argument value="putEntry(T, ObjectId, String, FileMode, ObjectLoader)"/>
+ </message_arguments>
+ </filter>
+ </resource>
<resource path="src/org/eclipse/jgit/transport/http/HttpConnection.java" type="org.eclipse.jgit.transport.http.HttpConnection">
<filter comment="OSGi semantic versioning rules allow to break implementors in minor releases" id="403767336">
<message_arguments>
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java
index 8543bd5f6a..6c7dca5c2e 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/ArchiveCommand.java
@@ -162,8 +162,8 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
* @param out
* archive object from createArchiveOutputStream
* @param path
- * full filename relative to the root of the archive
- * (with trailing '/' for directories)
+ * full filename relative to the root of the archive (with
+ * trailing '/' for directories)
* @param mode
* mode (for example FileMode.REGULAR_FILE or
* FileMode.SYMLINK)
@@ -171,9 +171,36 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
* blob object with data for this entry (null for
* directories)
* @throws IOException
- * thrown by the underlying output stream for I/O errors
+ * thrown by the underlying output stream for I/O errors
+ * @deprecated use
+ * {@link #putEntry(Closeable, ObjectId, String, FileMode, ObjectLoader)}
+ * instead
*/
+ @Deprecated
void putEntry(T out, String path, FileMode mode,
+ ObjectLoader loader) throws IOException;
+
+ /**
+ * Write an entry to an archive.
+ *
+ * @param out
+ * archive object from createArchiveOutputStream
+ * @param tree
+ * the tag, commit, or tree object to produce an archive for
+ * @param path
+ * full filename relative to the root of the archive (with
+ * trailing '/' for directories)
+ * @param mode
+ * mode (for example FileMode.REGULAR_FILE or
+ * FileMode.SYMLINK)
+ * @param loader
+ * blob object with data for this entry (null for
+ * directories)
+ * @throws IOException
+ * thrown by the underlying output stream for I/O errors
+ * @since 4.7
+ */
+ void putEntry(T out, ObjectId tree, String path, FileMode mode,
ObjectLoader loader) throws IOException;
/**
@@ -389,11 +416,11 @@ public class ArchiveCommand extends GitCommand<OutputStream> {
mode = FileMode.TREE;
if (mode == FileMode.TREE) {
- fmt.putEntry(outa, name + "/", mode, null); //$NON-NLS-1$
+ fmt.putEntry(outa, tree, name + "/", mode, null); //$NON-NLS-1$
continue;
}
walk.getObjectId(idBuf, 0);
- fmt.putEntry(outa, name, mode, reader.open(idBuf));
+ fmt.putEntry(outa, tree, name, mode, reader.open(idBuf));
}
outa.close();
return out;