git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] doc: gitignore: rejoin related paragraphs

From
Matt Hunter <m@lfurio.us>
Date
Nov 29, 2026, 09:15 UTC
Message-ID
<DN7KWQHLF7Q2.84SK0XQELPSU@lfurio.us>
In-Reply-To
<xmqq4id0qlze.fsf@gitster.g>
On Sat Nov 28, 2026 at 11:51 PM EST, Junio C Hamano wrote:
Show 10 quoted lines
>
> "Some text" and "another paragraph" leave the reader guessing which
> change caused the split, so citing commit 0f0ce07625 (doc: gitignore:
> clarify pattern base for info/exclude and core.excludesFile, 2026-03-28)
> as the culprit that tore the two connected parts apart would make the
> history clear.
>
> ...
>
> "preceding"?
Oops.  Yes, I'll incorporate both of these.
>
> I cannot grok the "is related, however" part of the last sentence.
> Could you clarify?

This is to acknowledge that the "for example" bullet relates to both of the "separator at beginning or middle" and "separator at end" bullets, but at the same time point out that the example more obviously shows the effects of the former point, how slashes at the beginning or middle anchor the rule to the current .gitignore's directory.

eg: There is an example and a counter-example for that bullet. But _both_ cases involve a rule ending in a slash to match a directory. There is not a clarifying sentence stating that "a pattern `doc/frotz` will not match the path `a/doc/frotz`, but it will match `doc/frotz` as a directory or non-directory".

The wording there is a little rough, but I think you will understand.
>
> In the current text, the five bullets run in this order
[mh: adding numbering to these bullet points, for easier referencing]
Show 13 quoted lines
>
>     (1) The slash "`/`" is used as the directory separator...
>
>     (2) If there is a separator at the beginning or middle (or both)...
>
>     (3) Patterns read from exclude sources that are outside the working tree...
>
>     (4) If there is a separator at the end of the pattern...
>
>     (5) 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).
In effect, this patch changes two details about the doc:
    - Move the interrupting bullet (3) out from the middle of (2), (4),
      and (5).
    - Swap the order of (2) and (4), specifically to place (2) next to
      (5), using my above explanation as a justification.
Though this has led to the problems you've pointed out:
>  - the exclude-sources bullet now appears before the document has
>    explained what a leading or middle separator does in a .gitignore
>    file.
This makes sense, and I will fix.
>  - placing the trailing-slash bullet before the beginning-or-middle
>    bullet reverses the "beginning, middle or end" order established by
>    the introductory bullet.

I somehow missed that (1) establishes this order. Your suggested change below sounds like the right way to improve things.

The thing that got me to prepare a patch in the first place was the jarring experience of reading (5) while bullet (2) was falling out of prominence in my brain, due to being multiple paragraphs up at that point. Though, your suggestion should make _this_ better as well.

Show 8 quoted lines
>
> Instead, moving the "Patterns read from exclude sources that are outside
> the working tree..." bullet down after the "For example..." bullet would
> restore the original sequence from commit 1a58bad014 (gitignore.txt:
> make slash-rules more readable, 2019-06-04).  It would keep the intro,
> beginning/middle rule, trailing-slash rule, and their combined example
> together, while placing the outside-working-tree note right after "(all
> paths are relative from the .gitignore file)".
Previous: Junio C HamanoNext: Matt Hunter
Message 3 of 4 in “doc: gitignore: rejoin related paragraphs”
  1. doc: gitignore: rejoin related paragraphsMatt Hunter, Nov 28, 2026
  2. Junio C HamanoNov 29, 2026
  3. Matt HunterNov 29, 2026
  4. doc: gitignore: rejoin related paragraphsMatt Hunter, Dec 1, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.