Browse Source

Fix timestamp in Zip archives

RevCommit.getCommitTime returns time in seconds since the epoch.
ZipArchiveEntry.setTime expects time in milliseconds.

Add the missing unit conversion to get the correct result.
Correct formatting to be consistent with the rest of the code.

Change-Id: I990b92f1d996ec8538d4857755694d91b142eb53
stable-4.7
Shawn Pearce 8 years ago
parent
commit
ff6e6c2214
  1. 4
      org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java

4
org.eclipse.jgit.archive/src/org/eclipse/jgit/archive/ZipFormat.java

@ -110,8 +110,8 @@ public final class ZipFormat extends BaseFormat implements
final ZipArchiveEntry entry = new ZipArchiveEntry(path); final ZipArchiveEntry entry = new ZipArchiveEntry(path);
if (tree instanceof RevCommit) { if (tree instanceof RevCommit) {
long commitTime = ((RevCommit) tree).getCommitTime(); long t = ((RevCommit) tree).getCommitTime() * 1000L;
entry.setTime(commitTime); entry.setTime(t);
} }
if (mode == FileMode.TREE) { if (mode == FileMode.TREE) {

Loading…
Cancel
Save