From cac6b8720ac9cdb360d03d3c8e2fa721c1802050 Mon Sep 17 00:00:00 2001
From: "arseny.kapoulkine@gmail.com"
 <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>
Date: Sat, 20 Jul 2013 05:55:22 +0000
Subject: [PATCH] Make sure newlines are consistent for both .zip and .tar.gz
 archives

git-svn-id: http://pugixml.googlecode.com/svn/trunk@953 99668b35-9821-0410-8761-19e4c4f06640
---
 tests/archive.pl | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/tests/archive.pl b/tests/archive.pl
index 0de09453..0a03b23e 100644
--- a/tests/archive.pl
+++ b/tests/archive.pl
@@ -17,6 +17,18 @@ for $source (sort {$a cmp $b} @sources)
 	my $meta = &readfile_meta($source);
 	my $file = $basedir . $source;
 
+    if (-T $source)
+    {
+        # convert all newlines to Unix format
+        $contents =~ s/\r//g;
+
+        if ($zip)
+        {
+            # convert all newlines to Windows format for .zip distribution
+            $contents =~ s/\n/\r\n/g;
+        }
+    }
+
 	if ($zip)
 	{
 		my $path = $file;
@@ -31,9 +43,6 @@ for $source (sort {$a cmp $b} @sources)
 	}
 	else
 	{
-		# tgz releases are for Unix people, Unix people like Unix newlines
-		$contents =~ s/\r//g if (-T $source);
-
 		$arch->add_data($file, $contents, $meta);
 	}
 }
-- 
GitLab