[libcode-tidyall-perl] 297/374: no single-line files (symlinks)

Jonas Smedegaard js at alioth.debian.org
Sun Sep 29 22:26:38 UTC 2013


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository libcode-tidyall-perl.

commit 8f8931219caef77e7679d3f7569c7046ad94bb45
Author: Jonathan Swartz <swartz at pobox.com>
Date:   Tue Oct 2 15:39:50 2012 -0700

    no single-line files (symlinks)
---
 lib/Code/TidyAll/Git/Prereceive.pm |    6 ++++++
 lib/Code/TidyAll/t/Git.pm          |   10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/lib/Code/TidyAll/Git/Prereceive.pm b/lib/Code/TidyAll/Git/Prereceive.pm
index a3a3791..768c409 100644
--- a/lib/Code/TidyAll/Git/Prereceive.pm
+++ b/lib/Code/TidyAll/Git/Prereceive.pm
@@ -84,6 +84,7 @@ sub create_tidyall {
     foreach my $rel_file ( $conf_file, @{ $self->extra_conf_files } ) {
         my $contents = $self->get_file_contents( $rel_file, $commit )
           or die sprintf( "could not find file '%s' in repo root", $rel_file );
+        write_file( "$temp_dir/$rel_file", $contents );
     }
     my $tidyall = $self->tidyall_class->new_from_conf_file(
         "$temp_dir/" . $conf_file,
@@ -298,4 +299,9 @@ input. Returns an error string if there was a problem, undef if no problems.
 
 =back
 
+=head1 KNOWN BUGS
+
+This hook will ignore any files with only a single line of content (no
+newlines), as an imperfect way of filtering out symlinks.
+
 =cut
diff --git a/lib/Code/TidyAll/t/Git.pm b/lib/Code/TidyAll/t/Git.pm
index 6e3464f..5605728 100644
--- a/lib/Code/TidyAll/t/Git.pm
+++ b/lib/Code/TidyAll/t/Git.pm
@@ -45,7 +45,7 @@ sub test_git : Tests {
 
     # Add foo.txt, which needs tidying
     #
-    write_file( "$work_dir/foo.txt", "abc" );
+    write_file( "$work_dir/foo.txt", "abc\n" );
     cmp_deeply( [ git_uncommitted_files($work_dir) ], [], "no uncommitted files" );
 
     # git add foo.txt and make sure it is now in uncommitted list
@@ -70,7 +70,7 @@ sub test_git : Tests {
 
     # Fix file and commit successfully
     #
-    write_file( "$work_dir/foo.txt", "ABC" );
+    write_file( "$work_dir/foo.txt", "ABC\n" );
     $output = capture_stderr { run( "git", "commit", "-m", "changed", "-a" ) };
     like( $output, qr/\[checked\] foo\.txt/, "checked foo.txt" );
     $committed->();
@@ -93,7 +93,7 @@ sub test_git : Tests {
 
     # Unfix file and commit
     #
-    write_file( "$clone_dir/foo.txt", "def" );
+    write_file( "$clone_dir/foo.txt", "def\n" );
     run( "git", "commit", "-m", "changed", "-a" );
     $committed->();
 
@@ -108,7 +108,7 @@ sub test_git : Tests {
 
     # Fix file and push successfully
     #
-    write_file( "$clone_dir/foo.txt", "DEF" );
+    write_file( "$clone_dir/foo.txt", "DEF\n" );
     $output = capture_stderr { run( "git", "commit", "-m", "changed", "-a" ) };
     $committed->();
     $output = capture_stderr { system( "git", "push" ) };
@@ -117,7 +117,7 @@ sub test_git : Tests {
 
     # Unfix file and commit
     #
-    write_file( "$clone_dir/foo.txt", "def" );
+    write_file( "$clone_dir/foo.txt", "def\n" );
     run( "git", "commit", "-m", "changed", "-a" );
     $committed->();
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libcode-tidyall-perl.git



More information about the Pkg-perl-cvs-commits mailing list