Thread (158 messages) 158 messages, 7 authors, 2021-04-09

Re: [PATCH 15/20] gitattributes doc: document multi-line userdiff patterns

flat view

From: Eric Sunshine <hidden>
Date: 2021-02-15 03:38:00

On Sun, Feb 14, 2021 at 7:56 PM Ævar Arnfjörð Bjarmason
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
Document the multi-line userdiff patterns and how their matching and
the negation syntax works.
[...]
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
diff --git a/Documentation/gitattributes.txt b/Documentation/gitattributes.txt
@@ -794,6 +794,23 @@ backslashes; the pattern above picks a line that begins with a
+Multiple patterns can be supplied by seperating them with
s/seperating/separating/
quoted hunk ↗ jump to hunk
+newlines. They will be matched one at a time and are compiled as
+separate patterns, and thus the first capture in each such pattern is
+`$1`, see further discussion of captures below.
I found the wording "separating them with newlines" ambiguous. I
couldn't figure out if that meant that there must be a blank line
between patterns. Would it be more accurate to say merely that the
patterns must be listed one per line?
quoted hunk ↗ jump to hunk
+Patterns that begin with "!" are negated (to match a literal "!" at
+the start of a line use e.g. "[!]"). A matching negated pattern will
+cause the matching line to be skipped. Use it to blacklist otherwise
+matching non-negated patterns. The last pattern must not be negated,
+we'll error out if that's the case.
The parenthesized comment makes it difficult to follow the discussion.
Moving the comment to the end of the paragraph would make it easier to
grok:

    Patterns that begin with "!" are negated. A matching...
    ...error out if that's the case. To match a literal "!" at
    the start of a line, use "[!]".

I think, also, you want s/matching line/matched line/.

Chris's comma-splice comment also seems applicable for the last
sentence in this paragraph.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help