RFR: 827: Copyright year differences can be regarded as a clean backport [v3]
Zhao Song
zsong at openjdk.org
Wed Sep 20 16:32:24 UTC 2023
On Mon, 18 Sep 2023 22:39:58 GMT, Erik Joelsson <erikj at openjdk.org> wrote:
>> Zhao Song has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - fix whitespace issue
>> - add unit test
>
> vcs/src/main/java/org/openjdk/skara/vcs/DiffComparator.java line 32:
>
>> 30: private static final Pattern COPYRIGHT_PATTERN = Pattern.compile("""
>> 31: -(.)*Copyright \\(c\\) (?:\\d|\\s|,)* Oracle and/or its affiliates\\. All rights reserved\\.
>> 32: \\+(.)*Copyright \\(c\\) (?:\\d|\\s|,)* Oracle and/or its affiliates\\. All rights reserved\\.
>
> If the only difference between these lines is the first character, we should only need one line.
> Suggestion:
>
> [-+](.)*Copyright \(c\) (?:\\d|\\s|,)* Oracle and/or its affiliates\. All rights reserved\.
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.
-------------
PR Review Comment: https://git.openjdk.org/skara/pull/1556#discussion_r1331905437
More information about the skara-dev
mailing list