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>
stable-4.5
Luca Milanesio 6 years ago committed by Matthias Sohn
parent
commit
2d116cd0ab
  1. 2
      org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java

2
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/PackFile.java

@ -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