workflows.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] get_maintainer: Survive querying missing files
@ 2024-02-09 12:24 Nikolai Kondrashov
  0 siblings, 0 replies; only message in thread
From: Nikolai Kondrashov @ 2024-02-09 12:24 UTC (permalink / raw)
  To: workflows, Joe Perches; +Cc: Nikolai Kondrashov

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.Kondrashov@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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-02-09 12:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-09 12:24 [PATCH] get_maintainer: Survive querying missing files Nikolai Kondrashov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox