RFR: 8376585: bin/update_copyright_year.sh could allow updating a specified list of files

Erik Joelsson erikj at openjdk.org
Wed Jan 28 14:43:54 UTC 2026


On Wed, 28 Jan 2026 14:18:43 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> There's a script to update copyright years for all files inside changesets in a given branch:
> bin/update_copyright_year.sh
> 
> Unfortunately, this is not always ideal for development branches: development branches may contain changes to files that are reverted to the original state later in that branch. As commits inside development branches are squashed at the end, these files are not updated in the final commits, and the copyright headers should not be updated.
> 
> My proposal here is to augment bin/update_copyright_year.sh with an ability to update the years for a given list of files. The list of files is read from stdin. Then one can use a command line like:
> 
> $ git diff upstream/master...<branch-name> | lsdiff | cut -d '/' -f 2- | bash bin/update_copyright_year.sh -m
> 
> To update the years for all files really modified on a given branch.
> 
> I am not an expert on shell/bash, so it is quite possible there are some mistakes here.
> 
> What do you think? Thanks!

I think this seems fine. Did you consider taking a file as input instead, but allowing a file argument of `-` to mean read from stdin? That seems to be a common behavior in the Unix world and would offer more flexibility. Not sure if it's worth doing, just a thought.

bin/update_copyright_year.sh line 29:

> 27: #  (Originally from xdono, Thanks!)
> 28: 
> 29: # To update Copyright years in for changes in a specific branch,

Suggestion:

# To update Copyright years for changes in a specific branch,

-------------

PR Review: https://git.openjdk.org/jdk/pull/29467#pullrequestreview-3717046782
PR Review Comment: https://git.openjdk.org/jdk/pull/29467#discussion_r2736929598


More information about the build-dev mailing list