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

[PATCH] Re: .gitignore Bug Report on the behavior of *

From
SRSeth Robertson <in-gitvger@baka.org>
Date
Sep 25, 2010, 20:40 UTC
Message-ID
<201009252040.o8PKedbo004741@no.baka.org>
In-Reply-To
<201009252203.48820.j6t@kdbg.org>
In message <201009252203.48820.j6t@kdbg.org>, Johannes Sixt writes:
    On Samstag, 25. September 2010, Seth Robertson wrote:
    > # Properly shows X and B/XX as untracked, as I expected
    > echo X > X; echo XX > B/XX; git status
    >
    > # I expected B/XX to show up as untracked
    > rm -f .gitignore B/.gitignore
    > echo '*' > .gitignore; echo '!*' > B/.gitignore; git status
    You should update your expectations to match what you got. ;-)
    To show why your expectations are wrong, consider a *huge* and
    *deep* directory with thousands and thousands of subdirectories,
    call it "usr", that should be ignored. The .gitignore at the
    top-level would just say:
      /usr
    Do you really expect git to walk down this ignored directory, just to make
    double-sure that really, really down there does nowhere exist a .gitignore
    that says "oh, wait, don't ignore *this* file"?

Hmm. No, not really, but having a .gitignore in a directory which has tracked git files in it seems somehow different, and at least to me the documentation of .gitignore suggests a different algorithm. How about this for a documentation patch?

Signed-off-by: Seth Robertson <in-gitvger@baka.org>
----------------------------------------------------------------------
diff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt
index 7dc2e8b..4f825d8 100644
--- a/Documentation/gitignore.txt
+++ b/Documentation/gitignore.txt
@@ -33,6 +33,8 @@ precedence, the last matching pattern decides the outcome):
    as the path, or in any parent directory, with patterns in the
    higher level files (up to the toplevel of the work tree) being overridden
    by those in lower level files down to the directory containing the file.
+   Any pattern causing a directory to be ignored will cause
+   any `.gitignore` file under that dirctory to be ignored.
    These patterns match relative to the location of the
    `.gitignore` file.  A project normally includes such
    `.gitignore` files in its repository, containing patterns for
Previous: Johannes SixtNext: Ævar Arnfjörð Bjarmason
Message 3 of 5 in “.gitignore Bug Report on the behavior of *”
  1. Seth RobertsonSep 25, 2010
  2. Johannes SixtSep 25, 2010
  3. Re: .gitignore Bug Report on the behavior of *Seth Robertson, Sep 25, 2010
  4. Ævar Arnfjörð BjarmasonSep 25, 2010
  5. Sverre RabbelierSep 25, 2010

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.