Do not die, but only warn when scripts/get_maintainer.pl is asked to
retrieve information about a missing file.

This allows scripts/checkpatch.pl to query MAINTAINERS while processing
patches which are removing files.

For example take:

    commit ebb0130dad75 ("dt-bindings: mailbox: convert bcm2835-mbox bindings 
to YAML")

It removes a file (and recreates it in another format, but that's
besides the point) which belongs to four subsystems.

This will work OK:

    scripts/get_maintainer.pl \
        0001-dt-bindings-mailbox-convert-bcm2835-mbox-bindings-to.patch

But if we try to give the file being removed to get_maintainer.pl
directly:

    scripts/get_maintainer.pl \
        -f Documentation/devicetree/bindings/mailbox/brcm,bcm2835-mbox.txt

It will abort with the following message:

    scripts/get_maintainer.pl: file
    'Documentation/devicetree/bindings/mailbox/brcm,bcm2835-mbox.txt'
    not found

Even though the state of the source tree we're running this on is
*exactly* the same.

This commit downgrades that error to a warning.

Signed-off-by: Nikolai Kondrashov <nikolai.kondras...@redhat.com>
---
 scripts/get_maintainer.pl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index ee1aed7e090ca..35e888e3c1889 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -542,7 +542,11 @@ foreach my $file (@ARGV) {
        if ((-d $file)) {
            $file =~ s@([^/])$@$1/@;
        } elsif (!(-f $file)) {
-           die "$P: file '${file}' not found\n";
+           if ($from_filename) {
+               warn "$P: file '${file}' not found\n";
+           } else {
+               die "$P: file '${file}' not found\n";
+           }
        }
     }
     if ($from_filename && (vcs_exists() && !vcs_file_exists($file))) {
-- 
2.43.0


Reply via email to