Skip to content

Commit 3c81760

Browse files
bebarinogitster
authored andcommitted
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 <[email protected]> Cc: Frank Rowand <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5fa0f52 commit 3c81760

File tree

14 files changed

+168
-0
lines changed

14 files changed

+168
-0
lines changed

Documentation/gitattributes.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -810,6 +810,8 @@ patterns are available:
810810

811811
- `css` suitable for cascading style sheets.
812812

813+
- `dts` suitable for devicetree (DTS) files.
814+
813815
- `fortran` suitable for source code in the Fortran language.
814816

815817
- `fountain` suitable for Fountain documents.

t/t4018-diff-funcname.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ diffpatterns="
3131
cpp
3232
csharp
3333
css
34+
dts
3435
fortran
3536
fountain
3637
golang

t/t4018/dts-labels

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/ {
2+
label_1: node1@ff00 {
3+
label2: RIGHT {
4+
vendor,some-property;
5+
6+
ChangeMe = <0x45-30>;
7+
};
8+
};
9+
};

t/t4018/dts-node-unitless

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/ {
2+
label_1: node1 {
3+
RIGHT {
4+
prop-array = <1>, <4>;
5+
ChangeMe = <0xffeedd00>;
6+
};
7+
};
8+
};

t/t4018/dts-nodes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/ {
2+
label_1: node1@ff00 {
3+
RIGHT@deadf00,4000 {
4+
#size-cells = <1>;
5+
ChangeMe = <0xffeedd00>;
6+
};
7+
};
8+
};

t/t4018/dts-nodes-comment1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/ {
2+
label_1: node1@ff00 {
3+
RIGHT@deadf00,4000 /* &a comment */ {
4+
#size-cells = <1>;
5+
ChangeMe = <0xffeedd00>;
6+
};
7+
};
8+
};

t/t4018/dts-nodes-comment2

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/ {
2+
label_1: node1@ff00 {
3+
RIGHT@deadf00,4000 { /* a trailing comment */
4+
#size-cells = <1>;
5+
ChangeMe = <0xffeedd00>;
6+
};
7+
};
8+
};

t/t4018/dts-reference

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
&label_1 {
2+
TEST = <455>;
3+
};
4+
5+
&RIGHT {
6+
vendor,some-property;
7+
8+
ChangeMe = <0x45-30>;
9+
};

t/t4018/dts-root

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
/RIGHT { /* Technically just supposed to be a slash */
2+
#size-cells = <1>;
3+
4+
ChangeMe = <0xffeedd00>;
5+
};

t/t4034-diff-words.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ test_language_driver bibtex
303303
test_language_driver cpp
304304
test_language_driver csharp
305305
test_language_driver css
306+
test_language_driver dts
306307
test_language_driver fortran
307308
test_language_driver html
308309
test_language_driver java

0 commit comments

Comments
 (0)