don't zero out files that are the same

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290380 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-20 07:07:23 +00:00
parent 2b44ccee57
commit 4330db96ab
3 changed files with 18 additions and 4 deletions

View File

@ -83,7 +83,15 @@ private void verifyDigestFile( File artifactSource, File artifactTarget, Rewrite
{
try
{
FileUtils.copyFile( digestSourceFile, digestTargetFile );
if ( digestTargetFile == null )
{
reporter.error( "No target digest file for path [" + artifactSource +
"] from source to target for digest algorithm: \'" + digestAlgorithm + "\'." );
}
else if ( !digestSourceFile.getCanonicalFile().equals( digestTargetFile.getCanonicalFile() ) )
{
FileUtils.copyFile( digestSourceFile, digestTargetFile );
}
}
catch ( IOException e )
{

View File

@ -70,7 +70,7 @@ private Artifact buildArtifact( String path, Reporter reporter )
Artifact result;
List pathParts = new ArrayList();
StringTokenizer st = new StringTokenizer( path, "/" );
StringTokenizer st = new StringTokenizer( path, "/\\" );
while ( st.hasMoreTokens() )
{
pathParts.add( st.nextToken() );
@ -80,7 +80,7 @@ private Artifact buildArtifact( String path, Reporter reporter )
if ( pathParts.size() < 4 )
{
reporter.error( "Not enough parts (4) in path " + path );
reporter.error( "Not enough parts (" + pathParts.size() + "/4) in path " + path );
return null;
}

View File

@ -456,9 +456,10 @@ private void copyMetadata( File source, File target, RewriteTransaction transact
boolean reportOnly )
throws IOException, DigestException, ReportWriteException
{
if ( source.exists() )
if ( source.exists() && !source.getCanonicalFile().equals( target.getCanonicalFile() ) )
{
File targetParent = target.getParentFile();
if ( !targetParent.exists() )
{
targetParent.mkdirs();
@ -516,6 +517,11 @@ private void copyArtifact( Artifact artifact, File artifactTarget )
{
File artifactSource = artifact.getFile();
if ( artifactSource.getCanonicalFile().equals( artifactTarget.getCanonicalFile() ) )
{
return;
}
InputStream inStream = null;
OutputStream outStream = null;
try