[Libreoffice-commits] .: Branch 'libreoffice-3-3' - git-hooks/pre-commit

Jan Holesovsky kendy at kemper.freedesktop.org
Thu Nov 11 08:36:38 PST 2010


 git-hooks/pre-commit |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

New commits:
commit f24bae33153b68f1cba7f7e8b5743cfefb0d077d
Author: Jan Holesovsky <kendy at suse.cz>
Date:   Thu Nov 11 17:02:10 2010 +0100

    git-hooks: Fix the check for leading tabs to work only some file types.
    
    The check for the file types was by mistake left out during the bash -> Perl
    change.

diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit
index 5a9a4b4..253f2dd 100755
--- a/git-hooks/pre-commit
+++ b/git-hooks/pre-commit
@@ -121,17 +121,18 @@ EOM
 
 # be strict about tabs - we don't want them at all, setup your editor
 # correctly ;-)
-my $check_ext = '\.(c|cpp|cxx|h|hrc|hxx|idl|inl|java|map|mk|MK|pmk|pl|pm|sdi|sh|src|tab|xcu|xml)$';
 my $err_ext = "";
 
 open( FILES, "git diff-index --cached --name-only $against |" ) || die "Cannot run git diff-index.";
 while ( my $file = <FILES> ) {
     chomp( $file );
-    open( F, "git diff-index -p --cached $against -- '$file' |" );
-    while ( my $line = <F> ) {
-        if ( $line =~ /^\+ *\t/ ) {
-            $err_ext .= "$file\n";
-            last;
+    if ( $file =~ /\.(c|cpp|cxx|h|hrc|hxx|idl|inl|java|map|mk|MK|pmk|pl|pm|sdi|sh|src|tab|xcu|xml)$/) {
+        open( F, "git diff-index -p --cached $against -- '$file' |" );
+        while ( my $line = <F> ) {
+            if ( $line =~ /^\+ *\t/ ) {
+                $err_ext .= "$file\n";
+                last;
+            }
         }
     }
     close( F );


More information about the Libreoffice-commits mailing list