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

Re: [PATCH] gitignore: root most patterns at the top-level directory

From
Johannes Sixt <j.sixt@viscovery.net>
Date
Oct 28, 2009, 07:21 UTC
Message-ID
<4AE7F0DC.6010508@viscovery.net>
In-Reply-To
<7vmy3cys0f.fsf@alter.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 5 quoted lines
> How does .cvsignore and .svnignore work?  Don't they have the same issue,
> and perhaps worse as I do not recall seeing a way to anchor a pattern to a
> particular directory like we do in their .SCMignore files?  And judging
> from the fact that they can get away with the lack of that "feature", this
> perhaps is not an issue in real life?
.cvsignore and .svnignore do not apply recursively to subdirectories, do they?
Show 9 quoted lines
> For example, it crossed my mind that perhaps we can change the ignore
> rules so that a non-globbing pattern is automatically anchored at the
> current directly but globbing ones are recursive as before.
> 
> If we do so, there is no need to change the current .gitignore entires.
> You need to spell a concrete filename as a glob pattern that matches only
> one path if you want the recursive behaviour.  E.g. if you have a Makefile
> per subdirectory, each of which generates and includes Makefile.depend
> file, you would write "Makefile.depen[d]" in the toplevel .gitignore file.

In one project that uses autotools, I have "Makefile" and "Makefile.in" in the top-level .gitignore. I would be forced to use this ugliness instead.

Granted, to write "/git", "/git-add", etc in .gitignore is not exactly pretty, either, but the reason that it is so extra-ugly in the git code itself is only because there are so many build products in a single directory that cannot be caught by a glob pattern. In practice, you usually have only a hand-full non-glob ignored files per directory; it doesn't hurt to anchor them using "/frotz" style.

> But that is a kind of incompatible change whose necessity is unproven and
> has to cook and wait.
I would be concerned by this change.
-- Hannes
Previous: Junio C HamanoNext: Jeff King
Message 3 of 5 in “gitignore: root most patterns at the top-level directory”
  1. gitignore: root most patterns at the top-level directoryJeff King, Oct 27, 2009
  2. Junio C HamanoOct 28, 2009
  3. Johannes SixtOct 28, 2009
  4. Jeff KingOct 30, 2009
  5. James PickensOct 30, 2009

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.