Allegedly this should improve performance, but I could not see it.
Change-Id: Id2057cb2cfcb46e94ff954483ce23f9c4a7edc5e
import java.io.File;
+import org.eclipse.jgit.util.FS;
+
/**
* Caches when a file was last read, making it possible to detect future edits.
* <p>
public static final FileSnapshot MISSING_FILE = new FileSnapshot(0, 0) {
@Override
public boolean isModified(File path) {
- return path.exists();
+ return FS.DETECTED.exists(path);
}
};
@Override
public boolean exists() {
- return objects.exists();
+ return fs.exists(objects);
}
@Override
}
final File dst = fileFor(id);
- if (dst.exists()) {
+ if (fs.exists(dst)) {
// We want to be extra careful and avoid replacing an object
// that already exists. We can't be sure renameTo() would
// fail on all platforms if dst exists, so we check first.
for (String refName : refs) {
// Lock the loose ref
File refFile = fileFor(refName);
- if (!refFile.exists())
+ if (!fs.exists(refFile))
continue;
LockFile rLck = new LockFile(refFile,
parent.getFS());
file = f;
if (f.isDirectory()) {
- if (new File(f, Constants.DOT_GIT).exists())
+ if (fs.exists(new File(f, Constants.DOT_GIT)))
mode = FileMode.GITLINK;
else
mode = FileMode.TREE;
private void loadRulesFromFile(IgnoreNode r, File exclude)
throws FileNotFoundException, IOException {
- if (exclude.exists()) {
+ if (FS.DETECTED.exists(exclude)) {
FileInputStream in = new FileInputStream(exclude);
try {
r.parse(in);