Hi Joe,
On 12/5/23 20:55, Joe Perches wrote:
On Tue, 2023-12-05 at 20:02 +0200, Nikolai Kondrashov wrote:
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.
Why is this useful?
Give a for-instance example please.
Sure! Take the ebb0130dad751e88c28ab94c71e46e8ee65427c9 commit for example.
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.
The latter (using the -f option) is the way checkpatch.pl works to fetch the
maintenance status (in is_maintained_obsolete()), and the way I implemented
fetching the tests from MAINTAINERS (in get_file_proposed_tests()).
This way seems to work better for checkpatch.pl, I suppose, because it can
link the error message to a specific file. But in principle, it might be
possible to just call get_maintainer.pl on every patch, if we really have to.
However, I feel that conceptually it should be possible to query MAINTAINERS
without actual *source* files being present in the tree (as opposed to patch
files which it needs to read), or even the tree being there at all.
I saw that we are printing a warning if the queried file is not there in the
git repo (I guess it's helpful?), and thought perhaps we can do the same
without the git repo too.
Hope that helps!
Nick