From: Matt Hunter Date: Tue, 01 Dec 2026 23:49:52 GMT Subject: [PATCH v2] doc: gitignore: rejoin related paragraphs Message-ID: <20261201235723.1920134-1-m@lfurio.us> In-Reply-To: <20261128071613.3386188-1-m@lfurio.us> Commit 0f0ce0762503 (doc: gitignore: clarify pattern base for info/exclude and core.excludesFile, 2026-03-28) added an explanation for interpreting patterns found in ignore files outside the working tree. This bullet is somewhat complementary to the preceding one. A reader may use them to better understand when patterns are interpreted relative to the repository root. However, by inserting the bullet here, it breaks up a sequence of a few more-closely related ones, added in 1a58bad0144d (gitignore.txt: make slash-rules more readable, 2019-06-04). Move this bullet down below the "For example..." text, to restore the original sequence from 1a58bad0144d while keeping the bullet after the "If there is a separator at the beginning or middle (or both)..." text that it builds from. Signed-off-by: Matt Hunter --- Changes in v2: - Only move the "exclude sources" bullet (below the example), and preserve the original order from commit 1a58bad0144d - Link to v1: https://patch.msgid.link/20261128071613.3386188-1-m@lfurio.us Documentation/gitignore.adoc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc index 7979e50f187e..a4f32f76acc9 100644 --- a/Documentation/gitignore.adoc +++ b/Documentation/gitignore.adoc @@ -96,11 +96,6 @@ PATTERN FORMAT particular `.gitignore` file itself. Otherwise the pattern may also match at any level below the `.gitignore` level. - - Patterns read from exclude sources that are outside the working tree, - such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if - they are specified at the root of the working tree, i.e. a leading "/" - in such patterns anchors the match at the root of the repository. - - If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories. @@ -110,6 +105,11 @@ PATTERN FORMAT and `a/frotz` that is a directory (all paths are relative from the `.gitignore` file). + - Patterns read from exclude sources that are outside the working tree, + such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if + they are specified at the root of the working tree, i.e. a leading "/" + in such patterns anchors the match at the root of the repository. + - An asterisk "`*`" matches anything except a slash. The character "`?`" matches any one character except "`/`". The range notation, e.g. `[a-zA-Z]`, can be used to match Interdiff against v1: diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc index 662632bdefc9..a4f32f76acc9 100644 --- a/Documentation/gitignore.adoc +++ b/Documentation/gitignore.adoc @@ -91,25 +91,25 @@ PATTERN FORMAT - The slash "`/`" is used as the directory separator. Separators may occur at the beginning, middle or end of the `.gitignore` search pattern. - - Patterns read from exclude sources that are outside the working tree, - such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if - they are specified at the root of the working tree, i.e. a leading "/" - in such patterns anchors the match at the root of the repository. - - - If there is a separator at the end of the pattern then the pattern - will only match directories, otherwise the pattern can match both - files and directories. - - If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular `.gitignore` file itself. Otherwise the pattern may also match at any level below the `.gitignore` level. + - If there is a separator at the end of the pattern then the pattern + will only match directories, otherwise the pattern can match both + files and directories. + - For example, a pattern `doc/frotz/` matches `doc/frotz` directory, but not `a/doc/frotz` directory; however `frotz/` matches `frotz` and `a/frotz` that is a directory (all paths are relative from the `.gitignore` file). + - Patterns read from exclude sources that are outside the working tree, + such as $GIT_COMMON_DIR/info/exclude and core.excludesFile, are treated as if + they are specified at the root of the working tree, i.e. a leading "/" + in such patterns anchors the match at the root of the repository. + - An asterisk "`*`" matches anything except a slash. The character "`?`" matches any one character except "`/`". The range notation, e.g. `[a-zA-Z]`, can be used to match base-commit: a018953688f1b10bddf91bff8747068f5f4746a4 -- 2.98.0.rc0.260.g8fecd35053