Browse Source

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
master
Antoine Levy-Lambert 22 years ago
parent
commit
cbab0d07f9
2 changed files with 10 additions and 8 deletions
  1. +1
    -1
      docs/manual/CoreTypes/selectors.html
  2. +9
    -7
      src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java

+ 1
- 1
docs/manual/CoreTypes/selectors.html View File

@@ -320,7 +320,7 @@
<tr>
<td valign="top">ignoreFileTimes</td>
<td valign="top">Whether to use file times in the comparison or not.
Default is true.
Default is false (time differences are significant).
</td>
<td valign="top" align="center">No</td>
</tr>


+ 9
- 7
src/main/org/apache/tools/ant/types/selectors/DifferentSelector.java View File

@@ -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


Loading…
Cancel
Save