Browse Source

Merge branch 'stable-4.7'

* stable-4.7:
  TarFormat: Use commit time as timestamp for entries

Change-Id: I24e2ad725a32b9b06af4dcac59454c08bd528387
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
stable-4.8
David Pursehouse 8 years ago
parent
commit
db8b2c4288
  1. 8
      org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/TarFormat.java

8
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();

Loading…
Cancel
Save