From 7063f0c870d9929196d5af13d4804bf21e23f6f8 Mon Sep 17 00:00:00 2001 From: Zsolt Parragi Date: Sat, 8 Feb 2025 09:29:43 +0000 Subject: [PATCH] Improve pgindent exclude handling: ignore empty lines Pgindent currently only ignores lines starting with a "#", or whitespace + "#", and treats everything else as a regex. This also means "", the empty string, and the empty regex matches everything. As ignoring everything doesn't have any practical use, and can still be done with a more explicit regex like ".*", this patch adds a special handling to the empty line (or line consisting only of whitespaces), to prevent exclude files that accidentally ignore everything. --- src/tools/pgindent/pgindent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/pgindent/pgindent b/src/tools/pgindent/pgindent index d8acce7e929..36d86a0d3dd 100755 --- a/src/tools/pgindent/pgindent +++ b/src/tools/pgindent/pgindent @@ -182,7 +182,7 @@ sub process_exclude while (my $line = <$eh>) { chomp $line; - next if $line =~ m/^#/; + next if $line =~ m/^#/ || $line eq ""; my $rgx = qr!$line!; @files = grep { $_ !~ /$rgx/ } @files if $rgx; } -- 2.34.1