git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@828141 13f79535-47bb-0310-9956-ffa450edef68master
@@ -507,6 +507,11 @@ Fixed bugs: | |||||
long file names in GNU longfile mode. | long file names in GNU longfile mode. | ||||
Bugzilla Report 47653. | Bugzilla Report 47653. | ||||
* The tar task failed to recognize that the archive had to be | |||||
(re-)created in some cases where the sources are filesystem based | |||||
resources but not filesets. | |||||
Bugzilla Report 48035. | |||||
Other changes: | Other changes: | ||||
-------------- | -------------- | ||||
@@ -581,9 +581,13 @@ public class Tar extends MatchingTask { | |||||
Vector files = (Vector) basedirToFilesMap.get(base); | Vector files = (Vector) basedirToFilesMap.get(base); | ||||
if (files == null) { | if (files == null) { | ||||
files = new Vector(); | files = new Vector(); | ||||
basedirToFilesMap.put(base, new Vector()); | |||||
basedirToFilesMap.put(base, files); | |||||
} | |||||
if (base == Copy.NULL_FILE_PLACEHOLDER) { | |||||
files.add(r.getFile().getAbsolutePath()); | |||||
} else { | |||||
files.add(r.getName()); | |||||
} | } | ||||
files.add(r.getName()); | |||||
} | } | ||||
iter = basedirs.iterator(); | iter = basedirs.iterator(); | ||||
while (iter.hasNext()) { | while (iter.hasNext()) { | ||||
@@ -22,6 +22,7 @@ | |||||
<import file="../antunit-base.xml" /> | <import file="../antunit-base.xml" /> | ||||
<target name="setUp"> | <target name="setUp"> | ||||
<mkdir dir="${input}" /> | |||||
<mkdir dir="${output}" /> | <mkdir dir="${output}" /> | ||||
</target> | </target> | ||||
@@ -72,4 +73,21 @@ | |||||
</cond:resourceexists> | </cond:resourceexists> | ||||
</au:assertFalse> | </au:assertFalse> | ||||
</target> | </target> | ||||
<target name="testSingleFile" depends="setUp" | |||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=48035"> | |||||
<touch file="${input}/foo.txt"/> | |||||
<tar destfile="${output}/foo.tar"> | |||||
<file file="${input}/foo.txt"/> | |||||
</tar> | |||||
<au:assertFileExists file="${output}/foo.tar"/> | |||||
<copy file="${output}/foo.tar" tofile="${output}/bar.tar" | |||||
preservelastmodified="true"/> | |||||
<sleep seconds="2"/> | |||||
<touch file="${input}/foo.txt"/> | |||||
<tar destfile="${output}/foo.tar"> | |||||
<file file="${input}/foo.txt"/> | |||||
</tar> | |||||
<au:assertDestIsOutofdate src="${output}/foo.tar" dest="${output}/bar.tar"/> | |||||
</target> | |||||
</project> | </project> |