On Sun, Jan 13, 2019 at 3:26 PM Alban Gruin <alban.gruin@xxxxxxxxx> wrote: > > Hi Stephen, > > thank you for your patch. I left a few comments below. > > Le 11/01/2019 à 22:51, Stephen Boyd a écrit : > > 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] > > > > [1] https://github.com/devicetree-org/devicetree-specification/releases/latest > > > > Cc: Rob Herring <robh+dt@xxxxxxxxxx> > > Signed-off-by: Stephen Boyd <sboyd@xxxxxxxxxx> > > --- > > Documentation/gitattributes.txt | 2 ++ > > t/t4018-diff-funcname.sh | 1 + > > t/t4018/dts-labels | 8 +++++++ > > t/t4018/dts-node-unitless | 8 +++++++ > > t/t4018/dts-nodes | 8 +++++++ > > t/t4018/dts-reference | 8 +++++++ > > t/t4034-diff-words.sh | 1 + > > t/t4034/dts/expect | 37 +++++++++++++++++++++++++++++++++ > > t/t4034/dts/post | 32 ++++++++++++++++++++++++++++ > > t/t4034/dts/pre | 32 ++++++++++++++++++++++++++++ > > userdiff.c | 9 ++++++++ > > 11 files changed, 146 insertions(+) > > create mode 100644 t/t4018/dts-labels > > create mode 100644 t/t4018/dts-node-unitless > > create mode 100644 t/t4018/dts-nodes > > create mode 100644 t/t4018/dts-reference > > create mode 100644 t/t4034/dts/expect > > create mode 100644 t/t4034/dts/post > > create mode 100644 t/t4034/dts/pre > > > > -%<- > > diff --git a/userdiff.c b/userdiff.c > > index 97007abe5b16..2bc964e11089 100644 > > --- a/userdiff.c > > +++ b/userdiff.c > > @@ -23,6 +23,15 @@ IPATTERN("ada", > > "[a-zA-Z][a-zA-Z0-9_]*" > > "|[-+]?[0-9][0-9#_.aAbBcCdDeEfF]*([eE][+-]?[0-9_]+)?" > > "|=>|\\.\\.|\\*\\*|:=|/=|>=|<=|<<|>>|<>"), > > +PATTERNS("dts", > > + /* Node name (with optional label and unit address) */ > > + "^[ \t]*((([a-zA-Z_][a-zA-Z0-9_]*: )?[a-zA-Z][a-zA-Z0-9,._+-]*(@[a-zA-Z0-9,._+-]+)?" > > From the spec, label and node names “shall be [between] 1 to 31 > characters in length”. It’s not enforced here, and I guess it’s not > really git’s job to check for this kind of rule. Others may disagree > with me, though. The spec does say 31 characters, but that's never been enforced. So, of course, there are occurrences in the wild (though maybe they were just property names, not node names). In any case, we plan to change the spec to increase the size. To what, I don't know. Rob