]> source.dussan.org Git - jgit.git/commitdiff
Use the new FS.exists method in commonly occuring places 34/10134/18
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Mon, 4 Feb 2013 00:11:29 +0000 (01:11 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 10 Feb 2014 10:26:57 +0000 (11:26 +0100)
Allegedly this should improve performance, but I could not see it.

Change-Id: Id2057cb2cfcb46e94ff954483ce23f9c4a7edc5e

org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/FileSnapshot.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/ObjectDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/RefDirectory.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/FileTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/WorkingTreeIterator.java

index 708bd64918c746dcda21dae94b1237a426a8ba78..02e2cb47d10b13e7ee5116f21f31853c900aa3a5 100644 (file)
@@ -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);
                }
        };
 
index 1795683aa8b83db9c543065f81e0c19abd6ed25f..434eadf5fa2a24f21664db45f2f97a7d7549f222 100644 (file)
@@ -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.
index c720bc574e30b435e0f010a679f1c6cbc4a46ec9..0abf0c89913b4db4fa618783ed10cd3ed0894050 100644 (file)
@@ -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());
index cd594cef47338c290bca969f8b4703f20c8d42be..ce8a50c87f47188a150e0fede9d3ced48e613ef8 100644 (file)
@@ -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;
index cb00fc83d99c358ce86b43784928927a5d0d22e2..75328c81c620f60834b35c47e8593ec8304e7dad 100644 (file)
@@ -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);