diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2021-10-04 11:24:06 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2021-10-12 15:13:44 +0200 |
commit | ae4412b2fce137da592846d0559ad7f9df1c53c7 (patch) | |
tree | b1dc18de54dc100b60e4a64bf5ab0418751e7ab4 /contrib | |
parent | e81c2baf70b7bb62e90ca23b7bd609664d1fa9f8 (diff) | |
download | NetworkManager-ae4412b2fce137da592846d0559ad7f9df1c53c7.tar.gz |
contrib/checkpatch: recognize git subtree merges
Make checkpatch.pl identify subtree merges in "git am"-formatted
patches and reconstruct the full path names based in the subtree root.
This fixes some spurious warnings for parts of the tree that use
different coding style from what we usually do.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/989
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/scripts/checkpatch.pl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl index 8ec581b543..330f452c13 100755 --- a/contrib/scripts/checkpatch.pl +++ b/contrib/scripts/checkpatch.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -n # SPDX-License-Identifier: GPL-2.0-or-later # -# Copyright (C) 2018 Red Hat, Inc. +# Copyright (C) 2018,2021 Red Hat, Inc. # # $ perldoc checkpatch.pl for eye-pleasing view of the manual: @@ -50,6 +50,7 @@ our $line_no; our $indent; our $check_is_todo; our $expect_spdx; +our $subdir; sub new_hunk { @@ -61,7 +62,8 @@ sub new_file { $expect_spdx = 0; $check_is_todo = 1; - $filename = shift; + $filename = $subdir // ''; + $filename .= shift; @functions_seen = (); } @@ -140,6 +142,7 @@ if ($is_patch) { /^(Reverts|Fixes): *(.*)/ and check_commit ($2, 1); /This reverts commit/ and next; /cherry picked from/ and next; + /^git-subtree-dir: (.*)/ and $subdir = "$1/"; /\bcommit (.*)/ and check_commit ($1, 0); next; } else { @@ -291,7 +294,7 @@ F<CONTRIBUTING> =head1 COPYRIGHT -Copyright (C) 2018 Red Hat +Copyright (C) 2018,2021 Red Hat This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by |