[prev in list] [next in list] [prev in thread] [next in thread] 

List:       subversion-dev
Subject:    [PATCH]: fix check-mime-type.pl for changes to 'svnlook proplist' output
From:       Leo Davis <ldavis () speechfxinc ! com>
Date:       2014-02-26 0:21:38
Message-ID: 1556940.9RUyJtFJ1Z () hurry ! speechfxinc ! com
[Download RAW message or body]

Hello,

I recently discovered that the old 'check-mime-type.pl' contrib script is I 
had installed on my server was broken when using subversion 1.8.5.  I looked 
for an updated script in the 1.8.5 branch and in trunk and discovered the 
script was also broken in those places as well.  After some digging, I found 
out when this change happened and patched the script.  I suspect (but don't 
know for sure) that this only affects subversion 1.8.x.

This patch is from trunk.

[[[
   Fix check-mime-type.pl for output changes to 'svnlook proplist'.

   The output format of 'svnlook proplist' was changed in revision 1416637.

   See also http://svn.haxx.se/dev/archive-2012-11/0510.shtml

   * contrib/hook-scripts/check-mime-type.pl:  Fix reading process output from 
'svnlook proplist'.
]]]

Regards,

Leo

["check-mime-type.patch" (check-mime-type.patch)]

Index: contrib/hook-scripts/check-mime-type.pl
===================================================================
--- contrib/hook-scripts/check-mime-type.pl	(revision 1571865)
+++ contrib/hook-scripts/check-mime-type.pl	(working copy)
@@ -116,6 +116,8 @@ foreach my $path ( @files_added )
 	{
 		my $mime_type;
 		my $eol_style;
+		my $seen_mime_type = 0;
+		my $seen_eol_style = 0;
 
 		# Parse the complete list of property values of the file $path to extract
 		# the mime-type and eol-style
@@ -122,13 +124,25 @@ foreach my $path ( @files_added )
 		foreach my $prop (&read_from_process($svnlook, 'proplist', $repos, '-t',
 		                  $txn, '--verbose', '--', $path))
 			{
-				if ($prop =~ /^\s*svn:mime-type : (\S+)/)
+				if ($prop =~ /^\s*svn:mime-type/)
 					{
+                                                $seen_mime_type = 1;
+					}
+				elsif ($seen_mime_type)
+					{
+						$prop =~ /^\s*(\S+)/;
 						$mime_type = $1;
+						$seen_mime_type = 0;
 					}
-				elsif ($prop =~ /^\s*svn:eol-style : (\S+)/)
+				elsif ($prop =~ /^\s*svn:eol-style/)
 					{
+                                                $seen_eol_style = 1;
+					}
+				elsif ($seen_eol_style)
+					{
+						$prop =~ /^\s*(\S+)/;
 						$eol_style = $1;
+						$seen_eol_style = 0;
 					}
 			}
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic