From: Jim Meyering Date: Tue, 3 Jan 2023 06:52:08 +0000 (-0800) Subject: update-copyright: also work with two or more updatable lines in a file X-Git-Tag: v1.0~1861 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=7f1b32336b063be3a672e9285f62c6b8ce5eb6e1;p=gnulib.git update-copyright: also work with two or more updatable lines in a file * build-aux/update-copyright: Replace every occurrence of the copyright line, not just the first one. * tests/test-update-copyright.sh: Add a test case for this. --- diff --git a/ChangeLog b/ChangeLog index 673da843c1..7868d312bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2023-01-10 Jim Meyering + + update-copyright: also work with two or more updatable lines in a file + * build-aux/update-copyright: Replace every occurrence of the copyright + line, not just the first one. + * tests/test-update-copyright.sh: Add a test case for this. + 2023-01-10 Bruno Haible immutable: Fix initialization failure on Android. diff --git a/build-aux/update-copyright b/build-aux/update-copyright index ce919bac72..99196fceef 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -137,7 +137,7 @@ eval 'exec perl -wSx -0777 -pi "$0" "$@"' if 0; -my $VERSION = '2020-04-04.15:07'; # UTC +my $VERSION = '2023-01-11.04:24'; # UTC # The definition above must lie within the first 8 lines in order # for the Emacs time-stamp write hook (at end) to update it. # If you change this file with Emacs, please let the write hook @@ -280,7 +280,7 @@ if (defined $stmt_re) } # Replace the old copyright statement. - s/$stmt_re/$stmt_wrapped/; + s/$stmt_re/$stmt_wrapped/g; } } else diff --git a/tests/test-update-copyright.sh b/tests/test-update-copyright.sh index 377cf8731e..a84ae34512 100755 --- a/tests/test-update-copyright.sh +++ b/tests/test-update-copyright.sh @@ -115,6 +115,10 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc. # Copyright (C) 1990-2005, 2007-2009 Free Software # Foundation, Inc. EOF +cat > $TMP.8 < $TMP-stdout 2> $TMP-stderr @@ -157,6 +161,10 @@ Copyright (C) 1990-2005, 2007-2009 Acme, Inc. # Copyright (C) 1990-2005, 2007-2009 Free Software # Foundation, Inc. EOF +compare - $TMP.8 < $TMP-stdout 2> $TMP-stderr