summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-02-04 01:11:29 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2014-02-10 11:26:57 +0100
commit5ef6d69532ebfc6c363c46f70a5f52d8369d2f9d (patch)
treea6c1aa794de824aa158d4392a4e887420a85b242 /org.eclipse.jgit
parent239f237be21a881434ce73f7e99d39b4324625b5 (diff)
downloadjgit-5ef6d69532ebfc6c363c46f70a5f52d8369d2f9d.tar.gz
jgit-5ef6d69532ebfc6c363c46f70a5f52d8369d2f9d.zip
Use the new FS.exists method in commonly occuring places
Allegedly this should improve performance, but I could not see it. Change-Id: Id2057cb2cfcb46e94ff954483ce23f9c4a7edc5e
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java2
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java2
5 files changed, 8 insertions, 6 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
index 708bd64918..02e2cb47d1 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
@@ -45,6 +45,8 @@ package org.eclipse.jgit.internal.storage.file;
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>
@@ -81,7 +83,7 @@ public class FileSnapshot {
public static final FileSnapshot MISSING_FILE = new FileSnapshot(0, 0) {
@Override
public boolean isModified(File path) {
- return path.exists();
+ return FS.DETECTED.exists(path);
}
};
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
index 1795683aa8..434eadf5fa 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
@@ -180,7 +180,7 @@ public class ObjectDirectory extends FileObjectDatabase {
@Override
public boolean exists() {
- return objects.exists();
+ return fs.exists(objects);
}
@Override
@@ -566,7 +566,7 @@ public class ObjectDirectory extends FileObjectDatabase {
}
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.
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
index c720bc574e..0abf0c8991 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
@@ -639,7 +639,7 @@ public class RefDirectory extends RefDatabase {
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());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
index cd594cef47..ce8a50c87f 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
@@ -168,7 +168,7 @@ public class FileTreeIterator extends WorkingTreeIterator {
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;
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
index cb00fc83d9..75328c81c6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java
@@ -1154,7 +1154,7 @@ public abstract class WorkingTreeIterator extends AbstractTreeIterator {
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);