Bugzilla – Attachment 189716 Details for
Bug 41274
Incremental test runs not properly skipping Schema files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41274: Koha::Devel::Files - Fix exception filtering in incremental mode
2ca53c4.patch (text/plain), 3.29 KB, created by
Martin Renvoize (ashimema)
on 2025-11-19 17:11:00 UTC
(
hide
)
Description:
Bug 41274: Koha::Devel::Files - Fix exception filtering in incremental mode
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2025-11-19 17:11:00 UTC
Size:
3.29 KB
patch
obsolete
>From 2ca53c49a7f28c8115b47092147de80e6b375b11 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@openfifth.co.uk> >Date: Wed, 19 Nov 2025 17:06:20 +0000 >Subject: [PATCH] Bug 41274: Koha::Devel::Files - Fix exception filtering in > incremental mode > >This patch fixes two bugs in the file exception filtering logic that >caused generated files (like Koha/Schema/Result/*) to not be excluded >properly when running in incremental/CI mode. > >Bug #1: Incorrect array assignment >Lines 173 and 204 were assigning an arrayref as a single element >instead of dereferencing it: > my @exception_files = $exceptions->{...}; # Wrong: creates array with 1 element (arrayref) > my @exception_files = @{ $exceptions->{...} }; # Correct: dereferences to array > >Bug #2: Pattern matching not supported >array_minus() only performs exact string matches, so patterns like >"Koha/Schema/Result" would not match "Koha/Schema/Result/Aqbasket.pm". > >The fix: >- Properly dereferences exception patterns array >- Replaces array_minus with grep + regex pattern matching >- Uses /^\Q$_\E/ to match file paths starting with exception patterns >- Removes now-unused Array::Utils dependency > >This ensures consistent behavior between: >- Non-incremental mode: Uses git ls-files with :(exclude) patterns >- Incremental mode: Now uses equivalent pattern matching > >Test plan: >1. Run tests locally (non-incremental): prove xt/perltidy.t >2. Verify Schema files are excluded >3. Run in CI (incremental mode) with Schema file changes >4. Verify Schema files are now correctly excluded (previously failing) >--- > Koha/Devel/Files.pm | 19 ++++++++++++++----- > 1 file changed, 14 insertions(+), 5 deletions(-) > >diff --git a/Koha/Devel/Files.pm b/Koha/Devel/Files.pm >index ae4152b19a4..1840050ff9b 100644 >--- a/Koha/Devel/Files.pm >+++ b/Koha/Devel/Files.pm >@@ -1,7 +1,6 @@ > package Koha::Devel::Files; > > use Modern::Perl; >-use Array::Utils qw( array_minus ); > > =head1 NAME > >@@ -170,8 +169,13 @@ sub ls_files { > push @files, grep { -e && /\.(tt|inc)$/ } @modified_files; > } > >- my @exception_files = $exceptions->{$filetype}->{ $self->{context} }; >- @files = array_minus( @files, @exception_files ); >+ my @exception_patterns = @{ $exceptions->{$filetype}->{ $self->{context} } // [] }; >+ if (@exception_patterns) { >+ @files = grep { >+ my $file = $_; >+ !grep { $file =~ /^\Q$_\E/ } @exception_patterns >+ } @files; >+ } > } else { > if ( $filetype eq 'pl' ) { > @files = $self->ls_perl_files; >@@ -201,8 +205,13 @@ sub ls_perl_files { > chomp @modified_files; > push @files, grep { -e && /\.(pl|PL|pm|t)$/ } @modified_files; > push @files, grep { -e && /^(svc|opac\/svc)/ } @modified_files; >- my @exception_files = $exceptions->{pl}->{ $self->{context} }; >- @files = array_minus( @files, @exception_files ); >+ my @exception_patterns = @{ $exceptions->{pl}->{ $self->{context} } // [] }; >+ if (@exception_patterns) { >+ @files = grep { >+ my $file = $_; >+ !grep { $file =~ /^\Q$_\E/ } @exception_patterns >+ } @files; >+ } > } else { > my $cmd = > sprintf q{git ls-files '*.pl' '*.PL' '*.pm' '*.t' svc opac/svc opac/unapi debian/build-git-snapshot %s}, >-- >2.51.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41274
:
189716
|
189776
|
189777
|
189778