Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matt Hunter <m@lfurio.us>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] doc: gitignore: rejoin related paragraphs
Date: Sat, 28 Nov 2026 20:51:01 -0800	[thread overview]
Message-ID: <xmqq4id0qlze.fsf@gitster.g> (raw)
In-Reply-To: <20261128071613.3386188-1-m@lfurio.us> (Matt Hunter's message of "Sat, 28 Nov 2026 02:14:34 -0500")

Matt Hunter <m@lfurio.us> writes:

> Some text has become separated from relevant context by the addition
> of another paragraph.

"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.

> Reorder the "If there is a separator at the beginning or middle..."
> item so that it is next to the "For example..." item that describes
> it.  The preceeding item about paths ending in "/" is related, however
> the example text speaks more to the moved paragraph than this one.

"preceding"?

I cannot grok the "is related, however" part of the last sentence.
Could you clarify?

> Signed-off-by: Matt Hunter <m@lfurio.us>
> ---
>
> Noticed while looking into
>  <20261106182945.1316297-1-aniketgupta3001@gmail.com> and
>  <xmqqh5hx4jz3.fsf_-_@gitster.g>
>
>  Documentation/gitignore.adoc | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/gitignore.adoc b/Documentation/gitignore.adoc
> index 7979e50f187e..662632bdefc9 100644
> --- a/Documentation/gitignore.adoc
> +++ b/Documentation/gitignore.adoc
> @@ -91,11 +91,6 @@ PATTERN FORMAT
>   - The slash "`/`" is used as the directory separator. Separators may
>     occur at the beginning, middle or end of the `.gitignore` search pattern.
>  
> - - 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.
> -
>   - 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 "/"
> @@ -105,6 +100,11 @@ PATTERN FORMAT
>     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.
> +
>   - 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

In Documentation/gitignore.adoc under "PATTERN FORMAT", the rule for
exclude sources outside the working tree builds directly on the
beginning-or-middle separator rule, because saying that a leading "/"
anchors matches at the repository root presupposes that the reader
already knows how a leading or middle separator makes a pattern relative
to a .gitignore directory.

In the current text, the five bullets run in this order

    - The slash "`/`" is used as the directory separator...

    - If there is a separator at the beginning or middle (or both)...

    - Patterns read from exclude sources that are outside the working tree...

    - If there is a separator at the end of the pattern...

    - 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).

Moving the beginning-or-middle separator bullet down below both the
exclude-sources bullet and the trailing-slash bullet introduces two
problems.

 - the exclude-sources bullet now appears before the document has
   explained what a leading or middle separator does in a .gitignore
   file.

 - placing the trailing-slash bullet before the beginning-or-middle
   bullet reverses the "beginning, middle or end" order established by
   the introductory bullet.

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)".

Wouldn't that give us a better presentation, I wonder?



  reply	other threads:[~2026-11-29  4:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28  7:14 [PATCH] doc: gitignore: rejoin related paragraphs Matt Hunter
2026-11-29  4:51 ` Junio C Hamano [this message]
2026-11-29  9:15   ` Matt Hunter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq4id0qlze.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=m@lfurio.us \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox