Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasuhiro Takagi2017-04-02 03:08:53 +0000
committerDavid Pursehouse2017-04-05 01:01:45 +0000
commitb26102469ca55b3dfbed3c0aeecb4b84df2628f6 (patch)
treeb8e8466226f570b3521305d5f09f0d7d443d9a1e /org.eclipse.jgit.archive
parent61a943e03d86b4ede1cf9a8184f00a7bb76143c1 (diff)
downloadjgit-b26102469ca55b3dfbed3c0aeecb4b84df2628f6.tar.gz
jgit-b26102469ca55b3dfbed3c0aeecb4b84df2628f6.tar.xz
jgit-b26102469ca55b3dfbed3c0aeecb4b84df2628f6.zip
TarFormat: Use commit time as timestamp for entries
This was already done for ZipFormat in 1448ec3. Change-Id: Ie131938a3f640c68718dc793d18dd35be5c71e7c Signed-off-by: Yasuhiro Takagi <ytakagi@bea.hi-ho.ne.jp> Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.archive')
-rw-r--r--org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
index c7e2583adb..7b7fbcd83e 100644
--- a/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
+++ b/org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java
@@ -59,6 +59,8 @@ import org.eclipse.jgit.archive.internal.ArchiveText;
import org.eclipse.jgit.lib.FileMode;
import org.eclipse.jgit.lib.ObjectId;
import org.eclipse.jgit.lib.ObjectLoader;
+import org.eclipse.jgit.revwalk.RevCommit;
+
/**
* Unix TAR format (ustar + some PAX extensions).
@@ -121,6 +123,12 @@ public final class TarFormat extends BaseFormat implements
path = path + "/"; //$NON-NLS-1$
final TarArchiveEntry entry = new TarArchiveEntry(path);
+
+ if (tree instanceof RevCommit) {
+ long t = ((RevCommit) tree).getCommitTime() * 1000L;
+ entry.setModTime(t);
+ }
+
if (mode == FileMode.TREE) {
out.putArchiveEntry(entry);
out.closeArchiveEntry();

Back to the top