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

Re: [PATCH 0/1] gitignore: ignore comments on the same line as a pattern

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 2, 2019, 06:51 UTC
Message-ID
<xmqqtv8rej30.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<pull.370.git.gitgitgadget@gmail.com>
"Chris Zehner via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 16 quoted lines
> Why make this change?
> =====================
>
> Add the ability to use # to put comments after ignore patterns. This is
> useful for documenting the reason for particular ignore patterns inclusion
> and structure.
>
> Right now a common convention in .gitignore files is to group patterns by
> similarity, using new lines beginning with one or more # characters as
> headings to explain these groupings. This works well when clarifying why
> broad classes of things are ignored, e.g. # build artifacts followed by
> several patterns.
>
> When leaving comments about a particular pattern it can be difficult to
> distinguish comments about a single patterns from comments used for file
> organization.

Not a good enough justification to break backward compatibility, I would have to say. If a single line is so tricky to deserve its own comment, perhaps a group of lines can be separated with the next group by a handful of blank lines for clarity (or the project can adopt a convention that differentiates between comments on a group and comments on an individual rule).

Previous: Junio C Hamano
Message 4 of 4 in “gitignore: ignore comments on the same line as a pattern”
  1. 0/1 gitignore: ignore comments on the same line as a patternChris Zehner via GitGitGadget, Oct 2, 2019
  2. 1/1 gitignore: ignore comments on the same line as a patternChris Zehner via GitGitGadget, Oct 2, 2019
  3. Junio C HamanoOct 2, 2019
  4. Junio C HamanoOct 2, 2019

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.