aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test/tst
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.test/tst
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.test/tst')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java10
1 files changed, 10 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
index fc8df42e26..54d58eca46 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/ArchiveCommandTest.java
@@ -57,6 +57,7 @@ import java.util.Map;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.junit.RepositoryTestCase;
import org.eclipse.jgit.lib.FileMode;
+import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.util.StringUtils;
@@ -203,12 +204,14 @@ public class ArchiveCommandTest extends RepositoryTestCase {
private final List<String> SUFFIXES = Collections
.unmodifiableList(Arrays.asList(".mck"));
+ @Override
public MockOutputStream createArchiveOutputStream(OutputStream s)
throws IOException {
return createArchiveOutputStream(s,
Collections.<String, Object> emptyMap());
}
+ @Override
public MockOutputStream createArchiveOutputStream(OutputStream s,
Map<String, Object> o) throws IOException {
for (Map.Entry<String, Object> p : o.entrySet()) {
@@ -224,11 +227,18 @@ public class ArchiveCommandTest extends RepositoryTestCase {
return new MockOutputStream();
}
+ @Override
public void putEntry(MockOutputStream out, String path, FileMode mode, ObjectLoader loader) {
+ putEntry(out, null, path, mode, loader);
+ }
+
+ @Override
+ public void putEntry(MockOutputStream out, ObjectId tree, String path, FileMode mode, ObjectLoader loader) {
String content = mode != FileMode.TREE ? new String(loader.getBytes()) : null;
entries.put(path, content);
}
+ @Override
public Iterable<String> suffixes() {
return SUFFIXES;
}