ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r727751 - in /ant/core/trunk/src: main/org/apache/tools/ant/taskdefs/Sync.java tests/antunit/taskdefs/sync-test.xml
Date Thu, 18 Dec 2008 15:47:49 GMT
Author: bodewig
Date: Thu Dec 18 07:47:49 2008
New Revision: 727751

URL: http://svn.apache.org/viewvc?rev=727751&view=rev
Log:
another sync preserveintarget edge case

Modified:
    ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
    ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml

Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java?rev=727751&r1=727750&r2=727751&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/Sync.java Thu Dec 18 07:47:49 2008
@@ -135,6 +135,11 @@
 
             int removedDirCount = 0;
             if (!myCopy.getIncludeEmptyDirs()) {
+                if (syncTarget != null
+                    && syncTarget.getPreserveEmptyDirs() != Boolean.TRUE) {
+                    preservedDirectories.clear();
+                }
+
                 removedDirCount =
                     removeEmptyDirectories(toDir, false, preservedDirectories);
             } else { // must be syncTarget.preserveEmptydirs == FALSE

Modified: ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml?rev=727751&r1=727750&r2=727751&view=diff
==============================================================================
--- ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml (original)
+++ ant/core/trunk/src/tests/antunit/taskdefs/sync-test.xml Thu Dec 18 07:47:49 2008
@@ -87,4 +87,34 @@
     <au:assertFileDoesntExist file="${output}/b/c"/>
   </target>
 
+  <target name="testPreserveEmptyAndIncludeEmptyFalse" depends="setUp">
+
+    <sync todir="${output}" includeEmptyDirs="false">
+      <fileset dir="${input}"/>
+      <preserveintarget preserveEmptyDirs="false">
+        <include name="**/b/**"/>
+      </preserveintarget>
+    </sync>
+
+    <au:assertFileDoesntExist file="${output}/a/bar.txt"/>
+    <au:assertFileExists file="${output}/a/foo.txt"/>
+    <au:assertFileExists file="${output}/b/baz.txt"/>
+    <au:assertFileDoesntExist file="${output}/b/c"/>
+  </target>
+
+  <target name="testPreserveEmptyAndIncludeEmptyTrue" depends="setUp">
+
+    <sync todir="${output}" includeEmptyDirs="true">
+      <fileset dir="${input}"/>
+      <preserveintarget preserveEmptyDirs="true">
+        <include name="**/b/**"/>
+      </preserveintarget>
+    </sync>
+
+    <au:assertFileDoesntExist file="${output}/a/bar.txt"/>
+    <au:assertFileExists file="${output}/a/foo.txt"/>
+    <au:assertFileExists file="${output}/b/baz.txt"/>
+    <au:assertFileExists file="${output}/b/c"/>
+  </target>
+
 </project>



Mime
View raw message