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

Re: gitignore bug: including files in an excluded directoy does not work.

From
Michael J Gruber <git@drmicha.warpmail.net>
Date
May 27, 2009, 20:55 UTC
Message-ID
<4A1DA8A7.9030606@drmicha.warpmail.net>
In-Reply-To
<809f58722b8bdb916fa7816cd80d3833-EhVcXl1BQAtYRw8cBxcBWQEwfgFLV15YQUBGAEFbXkI3XV8WXlhwH1RQWEFeRENtXlhdQ1hSWAtfWg==-webmailer2@server05.webmailer.hosteurope.de>
Florian Köberle venit, vidit, dixit 23.05.2009 11:18:
Show 27 quoted lines
> steps to reproduce:
> 
> git init
> echo /src/config > .gitignore
> echo \!/src/config/readme.txt >> .gitignore
> mkdir -p src/config
> touch src/config/readme.txt
> git add src
> 
> expected results:
> git should add the readme.txt file
> 
> actual result:
> git doesn't add the readme.txt file
> 
> 
> additional comments:
> 
> pre to the commit d6b8fc303b it was possible to archive the wished effect
> with this .gitignore file:
> ------------------
> /src/config/
> !/src/config/readme.txt
> ------------------
> The pre d6b8fc303b git fails to detect that it can exclude src/config.
> Thus it checks the directory content and finds out that the readme.txt
> matches both - the exclude and the include pattern.
The change in behaviour was intentional. You get the desired effect using:

/src/config/* !/src/config/readme.txt

Cheers, Michael

Previous: Florian KöberleNext: Florian Köberle
Message 2 of 3 in “gitignore bug: including files in an excluded directoy does not work.”
  1. Florian KöberleMay 23, 2009
  2. Michael J GruberMay 27, 2009
  3. Florian KöberleMay 29, 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.