Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdfd0f2b

Browse files
committed
Avoid re-writing files unnecessarily in src/tools/copyright.pl.
The existing coding resulted in touching every copyright-containingfile in the tree, even if it was already up to date. That doesn'tmatter much for the annual run, but it's an annoyance if you tryto use the script for mop-up at the close of a devel cycle, asI just did.Discussion:https://postgr.es/m/266030.1649685473@sss.pgh.pa.us
1 parentad385a4 commitdfd0f2b

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

‎src/tools/copyright.pl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,23 @@ sub wanted
4646
my@lines;
4747
tie@lines,"Tie::File",$File::Find::name;
4848

49+
# We process all lines because some files have copyright
50+
# strings embedded in them, e.g. src/bin/psql/help.c
4951
foreachmy$line (@lines)
5052
{
5153

5254
# We only care about lines with a copyright notice.
5355
nextunless$line =~m/$cc.*$pgdg/i;
5456

55-
# Skip line if already matches the current year; if not
56-
# we get $year-$year, e.g. 2012-2012
57+
# Skip line ifitalready matches the current year; if not
58+
# we get $year-$year, e.g. 2012-2012.
5759
nextif$line =~m/$cc$year,$pgdg/i;
5860

59-
# We process all lines because some files have copyright
60-
# strings embedded in them, e.g. src/bin/psql/help.c
61+
# Skip already-updated lines too, to avoid unnecessary
62+
# file updates.
63+
nextif$line =~m/$cc\d{4}-$year,$pgdg/i;
64+
65+
# Apply the update, relying on Tie::File to write the file.
6166
$line =~s/$cc (\d{4})-\d{4}, $pgdg/$ccliteral$1-$year,$pgdg/i;
6267
$line =~s/$cc (\d{4}), $pgdg/$ccliteral$1-$year,$pgdg/i;
6368
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp