diff options
author | Naoki Takezoe <takezoe@gmail.com> | 2016-12-29 13:47:17 +0900 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2017-02-18 10:47:27 +0100 |
commit | 1448ec37f9141d16da28151289e3d590c89fc739 (patch) | |
tree | fa9e8078b2e8bc9fc536e32c7fc0db5c303322f7 /org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java | |
parent | d3962fef6b9736c416c14dbb12b54c0a4a269763 (diff) | |
download | jgit-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.archive/src/org/eclipse/jgit/archive/TxzFormat.java')
-rw-r--r-- | org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java index 14839353d4..76d934f21c 100644 --- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java +++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TxzFormat.java @@ -53,6 +53,7 @@ import org.apache.commons.compress.archivers.ArchiveOutputStream; import org.apache.commons.compress.compressors.xz.XZCompressorOutputStream; import org.eclipse.jgit.api.ArchiveCommand; import org.eclipse.jgit.lib.FileMode; +import org.eclipse.jgit.lib.ObjectId; import org.eclipse.jgit.lib.ObjectLoader; /** @@ -80,10 +81,22 @@ public final class TxzFormat extends BaseFormat implements return tarFormat.createArchiveOutputStream(out, o); } + @Deprecated + @Override public void putEntry(ArchiveOutputStream out, String path, FileMode mode, ObjectLoader loader) throws IOException { - tarFormat.putEntry(out, path, mode, loader); + putEntry(out, null, path, mode,loader); + } + + /** + * @since 4.7 + */ + @Override + public void putEntry(ArchiveOutputStream out, + ObjectId tree, String path, FileMode mode, ObjectLoader loader) + throws IOException { + tarFormat.putEntry(out, tree, path, mode, loader); } public Iterable<String> suffixes() { |