Browse Source

Speed up check for modifications of tracked resources

We only need to check file existense if some other stat returns
a value that may mean that the file does not exist. File.length() == 0
or File.lastModified() == 0 are two such properties. We use length
here.

Change-Id: If626b12e7bb4da994b5c086f6a5b7a12c187261c
Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
stable-0.8
Robin Rosenberg 15 years ago
parent
commit
b919a94348
  1. 8
      org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java

8
org.eclipse.jgit/src/org/eclipse/jgit/lib/GitIndex.java

@ -567,8 +567,13 @@ public class GitIndex {
return true;
File file = getFile(wd);
long length = file.length();
if (length == 0) {
if (!file.exists())
return true;
}
if (length != size)
return true;
// JDK1.6 has file.canExecute
// if (file.canExecute() != FileMode.EXECUTABLE_FILE.equals(mode))
@ -600,9 +605,6 @@ public class GitIndex {
}
}
if (file.length() != size)
return true;
// Git under windows only stores seconds so we round the timestamp
// Java gives us if it looks like the timestamp in index is seconds
// only. Otherwise we compare the timestamp at millisecond prevision.

Loading…
Cancel
Save