RFR: 827: Copyright year differences can be regarded as a clean backport [v3]

Erik Joelsson erikj at openjdk.org
Wed Sep 20 21:08:57 UTC 2023

On Wed, 20 Sep 2023 21:02:23 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

>> But if we only use one line like you suggested, this will introduce a problem. In the backport PR, the user could make any change to the first line of copyright.  For example, the user could change the first line to "Random line" and the backport pr would still be considered as clean backport.  
>> Because the hunk will be 
>> @@ -2,1 +2,1 @@
>> - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
>> + * Random line.
>> and this hunk would match the regex pattern and be filtered out.
>> I think we still need two lines to make sure the user **only** changes the copyright years.
> Ah I get it now, this is a multiline pattern, not an either this line or that line. I thought you needed to tell something in the Java regex API that it was multiline, but maybe you don't if the pattern has a newline in it?

I think this should work as is. The `Pattern.MULTILINE` and `Pattern.DOTALL` are used to change the meaning of `^`, `$` and `.` respectively to work differently with newlines. I don't think that's relevant for this pattern which contains an explicit newline. Sorry for the confusion!


PR Review Comment: https://git.openjdk.org/skara/pull/1556#discussion_r1332183996

More information about the skara-dev mailing list