{"thread":{"id":"25244","subject":".gitignore Bug Report on the behavior of *","startedAt":"2010-09-25T19:23:19Z","lastAt":"2010-09-25T23:27:29Z","messageCount":5,"participants":["Seth Robertson","Johannes Sixt","Ævar Arnfjörð Bjarmason","Sverre Rabbelier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"151680","messageId":"201009251923.o8PJNJYE031841@no.baka.org","threadId":"25244","inReplyTo":null,"subject":".gitignore Bug Report on the behavior of *","fromName":"Seth Robertson","fromEmail":"in-gitvger@baka.org","sentAt":"2010-09-25T19:23:19Z","receivedAt":"2010-09-25T19:23:19Z","isPatch":false,"sender":{"key":"in-gitvger@baka.org","avatar":null},"body":"\nI'm not sure if this is a documentation bug, an actual bug, or my\nmis-interpretation of what is supposed to happen, however, this\nbehavior was not expected by other people as well.  This was tested\nusing git 1.7.2.3 and 1.7.3\n\nMy sample configuration:\n----------------------------------------------------------------------\nmkdir foo; cd foo; git init; echo A > A; mkdir B; echo B > B/B\ngit add .; git commit -a -m \"initial\"\n----------------------------------------------------------------------\n\n# Properly shows X and B/XX as untracked, as I expected\necho X > X; echo XX > B/XX; git status\n\n# I expected B/XX to show up as untracked\nrm -f .gitignore B/.gitignore\necho '*' > .gitignore; echo '!*' > B/.gitignore; git status\n\n# I expected B/XX to show up as untracked\nrm -f .gitignore B/.gitignore\necho '/*' > .gitignore; git status\n\n# Works as I expected\nrm -f .gitignore B/.gitignore\necho '/*X' > .gitignore; git status\n\n# Works as I expected\nrm -f .gitignore B/.gitignore\necho '*X' > .gitignore; echo '!*X' > B/.gitignore; git status\n\n# Works as I expected\nrm -f .gitignore B/.gitignore\necho -e '/*\\n!/B' > .gitignore; git status\n\n\t\t\t\t\t-Seth Robertson\n"},{"id":"151686","messageId":"201009252203.48820.j6t@kdbg.org","threadId":"25244","inReplyTo":"201009251923.o8PJNJYE031841@no.baka.org","subject":"Re: .gitignore Bug Report on the behavior of *","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2010-09-25T20:03:48Z","receivedAt":"2010-09-25T20:03:48Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"On Samstag, 25. September 2010, Seth Robertson wrote:\n> # Properly shows X and B/XX as untracked, as I expected\n> echo X > X; echo XX > B/XX; git status\n>\n> # I expected B/XX to show up as untracked\n> rm -f .gitignore B/.gitignore\n> echo '*' > .gitignore; echo '!*' > B/.gitignore; git status\n\nYou should update your expectations to match what you got. ;-)\n\nTo show why your expectations are wrong, consider a *huge* and *deep* \ndirectory with thousands and thousands of subdirectories, call it \"usr\", that \nshould be ignored. The .gitignore at the top-level would just say:\n\n  /usr\n\nDo you really expect git to walk down this ignored directory, just to make \ndouble-sure that really, really down there does nowhere exist a .gitignore \nthat says \"oh, wait, don't ignore *this* file\"?\n\n-- Hannes\n"},{"id":"151687","messageId":"201009252040.o8PKedbo004741@no.baka.org","threadId":"25244","inReplyTo":"201009252203.48820.j6t@kdbg.org","subject":"[PATCH] Re: .gitignore Bug Report on the behavior of *","fromName":"Seth Robertson","fromEmail":"in-gitvger@baka.org","sentAt":"2010-09-25T20:40:39Z","receivedAt":"2010-09-25T20:40:39Z","isPatch":true,"sender":{"key":"in-gitvger@baka.org","avatar":null},"body":"\nIn message <201009252203.48820.j6t@kdbg.org>, Johannes Sixt writes:\n\n    On Samstag, 25. September 2010, Seth Robertson wrote:\n    > # Properly shows X and B/XX as untracked, as I expected\n    > echo X > X; echo XX > B/XX; git status\n    >\n    > # I expected B/XX to show up as untracked\n    > rm -f .gitignore B/.gitignore\n    > echo '*' > .gitignore; echo '!*' > B/.gitignore; git status\n\n    You should update your expectations to match what you got. ;-)\n\n    To show why your expectations are wrong, consider a *huge* and\n    *deep* directory with thousands and thousands of subdirectories,\n    call it \"usr\", that should be ignored. The .gitignore at the\n    top-level would just say:\n\n      /usr\n\n    Do you really expect git to walk down this ignored directory, just to make\n    double-sure that really, really down there does nowhere exist a .gitignore\n    that says \"oh, wait, don't ignore *this* file\"?\n\nHmm.  No, not really, but having a .gitignore in a directory which has\ntracked git files in it seems somehow different, and at least to me the\ndocumentation of .gitignore suggests a different algorithm.  How about\nthis for a documentation patch?\n\nSigned-off-by: Seth Robertson <in-gitvger@baka.org>\n----------------------------------------------------------------------\ndiff --git a/Documentation/gitignore.txt b/Documentation/gitignore.txt\nindex 7dc2e8b..4f825d8 100644\n--- a/Documentation/gitignore.txt\n+++ b/Documentation/gitignore.txt\n@@ -33,6 +33,8 @@ precedence, the last matching pattern decides the outcome):\n    as the path, or in any parent directory, with patterns in the\n    higher level files (up to the toplevel of the work tree) being overridden\n    by those in lower level files down to the directory containing the file.\n+   Any pattern causing a directory to be ignored will cause\n+   any `.gitignore` file under that dirctory to be ignored.\n    These patterns match relative to the location of the\n    `.gitignore` file.  A project normally includes such\n    `.gitignore` files in its repository, containing patterns for\n"},{"id":"151689","messageId":"AANLkTinF2Bk0O96hPiB+WFzWAwEqu=wqdXEnM39+JOoN@mail.gmail.com","threadId":"25244","inReplyTo":"201009252203.48820.j6t@kdbg.org","subject":"Re: .gitignore Bug Report on the behavior of *","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-09-25T20:53:57Z","receivedAt":"2010-09-25T20:53:57Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Sat, Sep 25, 2010 at 20:03, Johannes Sixt <j6t@kdbg.org> wrote:\n> On Samstag, 25. September 2010, Seth Robertson wrote:\n>> # Properly shows X and B/XX as untracked, as I expected\n>> echo X > X; echo XX > B/XX; git status\n>>\n>> # I expected B/XX to show up as untracked\n>> rm -f .gitignore B/.gitignore\n>> echo '*' > .gitignore; echo '!*' > B/.gitignore; git status\n>\n> You should update your expectations to match what you got. ;-)\n>\n> To show why your expectations are wrong, consider a *huge* and *deep*\n> directory with thousands and thousands of subdirectories, call it \"usr\", that\n> should be ignored. The .gitignore at the top-level would just say:\n>\n>  /usr\n>\n> Do you really expect git to walk down this ignored directory, just to make\n> double-sure that really, really down there does nowhere exist a .gitignore\n> that says \"oh, wait, don't ignore *this* file\"?\n\nThat wouldn't be so expensive if the expectation that the .gitignore\nin /usr would only be considered if it had already been commited. Then\nwe'd just have to check if we have a tree for /usr, and whether\nthere's a gitignore there.\n\nBut doing this in the top-level .gitignore if possible is the best\nsolution.\n"},{"id":"151695","messageId":"AANLkTi=zkyTHyw-xakhdgDBNCPfkwEgPswvCVs31Sgqn@mail.gmail.com","threadId":"25244","inReplyTo":"201009252203.48820.j6t@kdbg.org","subject":"Re: .gitignore Bug Report on the behavior of *","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-09-25T23:27:29Z","receivedAt":"2010-09-25T23:27:29Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n<threadjacking rant>\n\nOn Sat, Sep 25, 2010 at 22:03, Johannes Sixt <j6t@kdbg.org> wrote:\n> Do you really expect git to walk down this ignored directory, just to make\n> double-sure that really, really down there does nowhere exist a .gitignore\n> that says \"oh, wait, don't ignore *this* file\"?\n\nYet when I (recursively for all files) 'git update-index\n--assume-unchanged some-dir' it will still looking at all the bloody\n.gitignore making it slow as moleasses.\n\n</rant>\n\nOf course, the above is an insane setup with a .gitignore file in each\nand every directory. But it would be so nice if git Just Worked even\nin insane cases!\n\n-- \nCheers,\n\nSverre Rabbelier\n"}]}