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>
This commit is contained in:
parent
61a943e03d
commit
b26102469c
|
@ -59,6 +59,8 @@
|
||||||
import org.eclipse.jgit.lib.FileMode;
|
import org.eclipse.jgit.lib.FileMode;
|
||||||
import org.eclipse.jgit.lib.ObjectId;
|
import org.eclipse.jgit.lib.ObjectId;
|
||||||
import org.eclipse.jgit.lib.ObjectLoader;
|
import org.eclipse.jgit.lib.ObjectLoader;
|
||||||
|
import org.eclipse.jgit.revwalk.RevCommit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unix TAR format (ustar + some PAX extensions).
|
* Unix TAR format (ustar + some PAX extensions).
|
||||||
|
@ -121,6 +123,12 @@ public void putEntry(ArchiveOutputStream out,
|
||||||
path = path + "/"; //$NON-NLS-1$
|
path = path + "/"; //$NON-NLS-1$
|
||||||
|
|
||||||
final TarArchiveEntry entry = new TarArchiveEntry(path);
|
final TarArchiveEntry entry = new TarArchiveEntry(path);
|
||||||
|
|
||||||
|
if (tree instanceof RevCommit) {
|
||||||
|
long t = ((RevCommit) tree).getCommitTime() * 1000L;
|
||||||
|
entry.setModTime(t);
|
||||||
|
}
|
||||||
|
|
||||||
if (mode == FileMode.TREE) {
|
if (mode == FileMode.TREE) {
|
||||||
out.putArchiveEntry(entry);
|
out.putArchiveEntry(entry);
|
||||||
out.closeArchiveEntry();
|
out.closeArchiveEntry();
|
||||||
|
|
Loading…
Reference in New Issue