Browse Source

Use FileSnapshot to get lastModified on PackFile

Do not redundantly call File.lastModified() for extracting the
timestamp of the PackFile but rather use consistently the FileSnapshot
which reads all file attributes in a single bulk call.

Change-Id: I932675ae4fe56dcd3833dac249816f097303bb09
Signed-off-by: Luca Milanesio <luca.milanesio@gmail.com>
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
tags/v4.5.6.201903121547-r
Luca Milanesio 5 years ago
parent
commit
2d116cd0ab

+ 1
- 1
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java View File

@@ -164,8 +164,8 @@ public class PackFile implements Iterable<PackIndex.MutableEntry> {
*/
public PackFile(final File packFile, int extensions) {
this.packFile = packFile;
this.packLastModified = (int) (packFile.lastModified() >> 10);
this.fileSnapshot = FileSnapshot.save(packFile);
this.packLastModified = (int) (fileSnapshot.lastModified() >> 10);
this.extensions = extensions;

// Multiply by 31 here so we can more directly combine with another

Loading…
Cancel
Save