From eddba8351ca38be24f8ab1eeefb41ae805373a2c Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 8 Mar 2016 16:24:43 -0500 Subject: [PATCH] Bug 16008: noisy "fatal" warning when new file is moved in another patch The failure was tracked down to check_forbidden_patterns in QohA/File.pm's check_forbidden_patterns function. As there can't be any forbidden patterns on a non-existent file, this patch returns the default 1 when the file being checked does not exist. It maintains a warning message as suggested in comment #2. It is better to create another check as stated in comment #2, but I figure I'll share my less than perfect work anyways. TEST PLAN --------- apply bug 15870 to your koha run qa test tools -- see the warning apply this patch to your qa test tools run qa test tools -- no more warning --- QohA/File.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/QohA/File.pm b/QohA/File.pm index 420dfbd..2a3985d 100644 --- a/QohA/File.pm +++ b/QohA/File.pm @@ -46,6 +46,13 @@ sub check_forbidden_patterns { # For the first pass, I don't want to launch any test. return 1 if $self->pass == 0; + # Patches may create and move files. + unless (-e $self->path) { + # \n on a warn or die eliminates the at line # mess. + warn $self->path . " was created and removed in patchset!\n"; + return 1; + } + my $git = QohA::Git->new(); my $diff_log = $git->diff_log($cnt, $self->path); my @forbidden_patterns = @$patterns; -- 2.1.4