userdiff: add a builtin pattern for dts files

The Linux kernel receives many patches to the devicetree files each
release. The hunk header for those patches typically show nothing,
making it difficult to figure out what node is being modified without
applying the patch or opening the file and seeking to the context. Let's
add a builtin 'dts' pattern to git so that users can get better diff
output on dts files when they use the diff=dts driver.

The regex has been constructed based on the spec at devicetree.org[1]
and with some help from Johannes Sixt.

[1] https://github.com/devicetree-org/devicetree-specification/releases/latest

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Stephen Boyd
2019-08-19 14:22:43 -07:00
committed by Junio C Hamano
parent 5fa0f5238b
commit 3c81760bc6
14 changed files with 168 additions and 0 deletions

32
t/t4034/dts/pre Normal file
View File

@ -0,0 +1,32 @@
/ {
this_handle: node@f00 {
compatible = "mydev";
string-prop = start: "hello world!" end: ;
#size-cells = <0+0>;
reg = <0xf00>;
prop = <1>;
prop = <-1e10>;
prop = <(!3)>;
prop = <(~3)>;
prop = <(3*4)>;
prop = <(3&4)>;
prop = <(3*4)>;
prop = <(3/4)>;
prop = <(3%4)>;
prop = <(3+4)>;
prop = <(3-4)>;
prop = /bits/ 64 <(3<<4)>;
prop = <(3>>4)>;
prop = <(3&4)>;
prop = <(3^4)>;
prop = <(3|4)>;
prop = <(3&&4)>;
prop = <(3||4)>;
prop = <(4?5:3)>;
list = <&this_handle>, <0 0 0 0>;
};
&phandle {
pre-phandle = <&this_handle>;
};
};