From cbab0d07f986f641ed6a0c15858c93650f0d78db Mon Sep 17 00:00:00 2001 From: Antoine Levy-Lambert Date: Sat, 24 May 2003 13:52:49 +0000 Subject: [PATCH] While reviewing this contribution, I saw that the original test in line 120 of DifferentSelector.java : if(sameDate && !ignoreFileTimes) { return true; } was wrong. I changed it to if (!sameDate) { return true; } Also, DifferentSelector has no Junit test yet, this should be done. PR: 20205 Submitted by: Jeff Turner (jefft at apache dot org) git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@274611 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/CoreTypes/selectors.html | 2 +- .../ant/types/selectors/DifferentSelector.java | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/docs/manual/CoreTypes/selectors.html b/docs/manual/CoreTypes/selectors.html index 0fe8e0bf8..09374f815 100755 --- a/docs/manual/CoreTypes/selectors.html +++ b/docs/manual/CoreTypes/selectors.html @@ -320,7 +320,7 @@ ignoreFileTimes Whether to use file times in the comparison or not. - Default is true. + Default is false (time differences are significant). No diff --git a/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java b/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java index 78182f4f6..d7410613f 100644 --- a/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java +++ b/src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java @@ -110,14 +110,16 @@ public class DifferentSelector extends MappingSelector { return true; } - //same date if dest timestamp is within granularity of the srcfile - boolean sameDate; - sameDate = destfile.lastModified() >= srcfile.lastModified() - granularity - && destfile.lastModified() <= srcfile.lastModified() + granularity; + if (!ignoreFileTimes) { + //same date if dest timestamp is within granularity of the srcfile + boolean sameDate; + sameDate = destfile.lastModified() >= srcfile.lastModified() - granularity + && destfile.lastModified() <= srcfile.lastModified() + granularity; - //and when ignoreFileTimes is set we claim the files are now equal - if(sameDate && !ignoreFileTimes) { - return true; + // different dates => different files + if(!sameDate) { + return true; + } } //here do a bulk comparison