Index: contrib/hook-scripts/check-mime-type.pl =================================================================== --- contrib/hook-scripts/check-mime-type.pl (revision 1878391) +++ contrib/hook-scripts/check-mime-type.pl (working copy) @@ -1,18 +1,19 @@ #!/usr/bin/env perl # ==================================================================== -# commit-mime-type-check.pl: check that every added file has the -# svn:mime-type property set and every added file with a mime-type -# matching text/* also has svn:eol-style set. If any file fails this -# test the user is sent a verbose error message suggesting solutions and -# the commit is aborted. +# check-mime-type.pl: check that every added or property-modified file +# has the svn:mime-type property set and every added or property-modified +# file with a mime-type matching text/* also has svn:eol-style set. +# If any file fails this test the user is sent a verbose error message +# suggesting solutions and the commit is aborted. # -# Usage: commit-mime-type-check.pl REPOS TXN-NAME +# Usage: check-mime-type.pl REPOS TXN-NAME # ==================================================================== -# Most of commit-mime-type-check.pl was taken from +# Most of check-mime-type.pl was taken from # commit-access-control.pl, Revision 9986, 2004-06-14 16:29:22 -0400. # ==================================================================== # Copyright (c) 2000-2004 CollabNet. All rights reserved. +# Copyright (c) 2014-2020 Apache Software Foundation (ASF). # # This software is licensed as described in the file COPYING, which # you should have received as part of this distribution. The terms @@ -100,19 +101,20 @@ my $tmp_dir = '/tmp'; chdir($tmp_dir) or die "$0: cannot chdir `$tmp_dir': $!\n"; -# Figure out what files have added using svnlook. -my @files_added; +# Figure out what files have been added/property-modified using svnlook. +my @paths_to_check; +my $props_changed_re = qr/^(?:A |[U_ ]U) (.*[^\/])$/; foreach my $line (&read_from_process($svnlook, 'changed', $repos, '-t', $txn)) { - # Add only files that were added to @files_added - if ($line =~ /^A. (.*[^\/])$/) + # Add only files that were added/property-modified to @paths_to_check + if ($line =~ /$props_changed_re/) { - push(@files_added, $1); + push(@paths_to_check, $1); } } my @errors; -foreach my $path ( @files_added ) +foreach my $path ( @paths_to_check ) { my $mime_type; my $eol_style; @@ -183,8 +185,8 @@ if (@errors) join("\n", @errors), "\n\n", <