summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/tools/copyright.pl13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/tools/copyright.pl b/src/tools/copyright.pl
index cc5411673c0..182177e9b6b 100755
--- a/src/tools/copyright.pl
+++ b/src/tools/copyright.pl
@@ -46,18 +46,23 @@ sub wanted
my @lines;
tie @lines, "Tie::File", $File::Find::name;
+ # We process all lines because some files have copyright
+ # strings embedded in them, e.g. src/bin/psql/help.c
foreach my $line (@lines)
{
# We only care about lines with a copyright notice.
next unless $line =~ m/$cc.*$pgdg/i;
- # Skip line if already matches the current year; if not
- # we get $year-$year, e.g. 2012-2012
+ # Skip line if it already matches the current year; if not
+ # we get $year-$year, e.g. 2012-2012.
next if $line =~ m/$cc $year, $pgdg/i;
- # We process all lines because some files have copyright
- # strings embedded in them, e.g. src/bin/psql/help.c
+ # Skip already-updated lines too, to avoid unnecessary
+ # file updates.
+ next if $line =~ m/$cc \d{4}-$year, $pgdg/i;
+
+ # Apply the update, relying on Tie::File to write the file.
$line =~ s/$cc (\d{4})-\d{4}, $pgdg/$ccliteral $1-$year, $pgdg/i;
$line =~ s/$cc (\d{4}), $pgdg/$ccliteral $1-$year, $pgdg/i;
}