Skip to content
Snippets Groups Projects
Commit b919a943 authored by Robin Rosenberg's avatar Robin Rosenberg
Browse files

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: default avatarRobin Rosenberg <robin.rosenberg@dewire.com>
parent 2b6c555a
No related branches found
No related tags found
No related merge requests found
...@@ -567,7 +567,12 @@ public boolean isModified(File wd, boolean forceContentCheck) { ...@@ -567,7 +567,12 @@ public boolean isModified(File wd, boolean forceContentCheck) {
return true; return true;
File file = getFile(wd); File file = getFile(wd);
if (!file.exists()) long length = file.length();
if (length == 0) {
if (!file.exists())
return true;
}
if (length != size)
return true; return true;
// JDK1.6 has file.canExecute // JDK1.6 has file.canExecute
...@@ -600,9 +605,6 @@ public boolean isModified(File wd, boolean forceContentCheck) { ...@@ -600,9 +605,6 @@ public boolean isModified(File wd, boolean forceContentCheck) {
} }
} }
if (file.length() != size)
return true;
// Git under windows only stores seconds so we round the timestamp // Git under windows only stores seconds so we round the timestamp
// Java gives us if it looks like the timestamp in index is seconds // Java gives us if it looks like the timestamp in index is seconds
// only. Otherwise we compare the timestamp at millisecond prevision. // only. Otherwise we compare the timestamp at millisecond prevision.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment