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

Re: [PATCH] dir.c: allow re-include after a dir is excluded in some cases

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 19, 2014, 18:48 UTC
Message-ID
<xmqqmw7nrpqh.fsf@gitster.dls.corp.google.com>
In-Reply-To
<1416393058-5497-1-git-send-email-pclouds@gmail.com>
Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
Show 27 quoted lines
> diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
> index 09e82c3..0340c44 100644
> --- a/Documentation/gitignore.txt
> +++ b/Documentation/gitignore.txt
> @@ -82,10 +82,9 @@ PATTERN FORMAT
>  
>   - An optional prefix "`!`" which negates the pattern; any
>     matching file excluded by a previous pattern will become
> -   included again. It is not possible to re-include a file if a parent
> -   directory of that file is excluded. Git doesn't list excluded
> -   directories for performance reasons, so any patterns on contained
> -   files have no effect, no matter where they are defined.
> +   included again.
> +   It is usually not possible to re-include a file if a parent
> +   directory of that file is excluded. See NOTES for details.
>     Put a backslash ("`\`") in front of the first "`!`" for patterns
>     that begin with a literal "`!`", for example, "`\!important!.txt`".
>  
> @@ -144,6 +143,12 @@ use 'git update-index {litdd}assume-unchanged'.
>  To stop tracking a file that is currently tracked, use
>  'git rm --cached'.
>  
> +It is usually not possible to re-include a file if a parent directory
> +of that file is excluded because of performance reasons. However, if
> +there are negative rules in the same .gitignore file that contains the
> +rule to ignore a specific directory, and those negative rules contain
> +a slash, then re-inclusion is possible.
Does that mean "performance reasons" goes out the window???

What trade-off are the users making by choosing to do so? Is it explained in the documentation well enough to allow them to make an informed decision?

Previous: Nguyễn Thái Ngọc DuyNext: Duy Nguyen
Message 4 of 7 in “.gitignore sub-dir exclusions not overriding '*'”
  1. Phil PennockNov 19, 2014
  2. Duy NguyenNov 19, 2014
  3. dir.c: allow re-include after a dir is excluded in some casesNguyễn Thái Ngọc Duy, Nov 19, 2014
  4. Junio C HamanoNov 19, 2014
  5. Duy NguyenNov 20, 2014
  6. Phil PennockNov 19, 2014
  7. Duy NguyenNov 20, 2014

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.