{"thread":{"id":"50571","subject":"does \"git clean\" deliberately ignore \"core.excludesFile\"?","startedAt":"2019-02-23T15:11:58Z","lastAt":"2019-02-24T14:21:08Z","messageCount":7,"participants":["Robert P. J. Day","Junio C Hamano","Johannes Schindelin"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"370023","messageId":"alpine.LFD.2.21.1902231008530.28936@localhost.localdomain","threadId":"50571","inReplyTo":null,"subject":"does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2019-02-23T15:11:53Z","receivedAt":"2019-02-23T15:11:58Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  not sure why i never noticed this before, but the \"-x\" option for\n\"git clean\" reads:\n\n -x\n     Don’t use the standard ignore rules read from .gitignore\n     (per directory) and $GIT_DIR/info/exclude, but do still use\n     the ignore rules given with -e options. This allows\n     removing all untracked files, including build products.\n     This can be used (possibly in conjunction with git reset)\n     to create a pristine working directory to test a clean\n     build.\n\n  but i see no mention of whether the file specified by\ncore.excludesFile is taken into account, and perusing the source code\ndoesn't seem to show that command checking that config option.\n\n  am i misreading something? and if not, is there a reason git clean\ndoes not consult core.excludesFile?\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================"},{"id":"370024","messageId":"xmqqimxao76b.fsf@gitster-ct.c.googlers.com","threadId":"50571","inReplyTo":"alpine.LFD.2.21.1902231008530.28936@localhost.localdomain","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-02-23T15:28:44Z","receivedAt":"2019-02-23T15:28:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n\n>   am i misreading something? and if not, is there a reason git clean\n> does not consult core.excludesFile?\n\nCan you ask \"git log\" and \"git blame\" whch of  core.excludesFile and\n\"clean -x\" features came earlier and by how big a difference?\n\nMost likely this is because the exclude came much much later, and\neither we forgot to teach the implementation of clean to pay\nattention to it or (much more likely) the implementaiton is fine but\nwe did not update the doc, which was trying to overly be exhaustive,\ndoing no good (if the original just stopped at saying \"... the\nstandard ignore rules read from the usual places\", we won't be\nhaving this discussion).\n"},{"id":"370027","messageId":"nycvar.QRO.7.76.6.1902231905180.45@tvgsbejvaqbjf.bet","threadId":"50571","inReplyTo":"xmqqimxao76b.fsf@gitster-ct.c.googlers.com","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-02-23T18:06:02Z","receivedAt":"2019-02-23T18:06:52Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 23 Feb 2019, Junio C Hamano wrote:\n\n> \"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n> \n> >   am i misreading something? and if not, is there a reason git clean\n> > does not consult core.excludesFile?\n> \n> Can you ask \"git log\" and \"git blame\" whch of  core.excludesFile and\n> \"clean -x\" features came earlier and by how big a difference?\n\nOr maybe we can have a look why the `core.excludesfile` regression test\ncase in t7300 does not catch this?\n\nhttps://github.com/git/git/blob/v2.21.0-rc2/t/t7300-clean.sh#L408-L417\n\nCiao,\nDscho\n"},{"id":"370028","messageId":"nycvar.QRO.7.76.6.1902231912370.45@tvgsbejvaqbjf.bet","threadId":"50571","inReplyTo":"nycvar.QRO.7.76.6.1902231905180.45@tvgsbejvaqbjf.bet","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-02-23T18:19:00Z","receivedAt":"2019-02-23T18:19:48Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 23 Feb 2019, Johannes Schindelin wrote:\n\n> On Sat, 23 Feb 2019, Junio C Hamano wrote:\n> \n> > \"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n> > \n> > >   am i misreading something? and if not, is there a reason git clean\n> > > does not consult core.excludesFile?\n> > \n> > Can you ask \"git log\" and \"git blame\" whch of  core.excludesFile and\n> > \"clean -x\" features came earlier and by how big a difference?\n> \n> Or maybe we can have a look why the `core.excludesfile` regression test\n> case in t7300 does not catch this?\n> \n> https://github.com/git/git/blob/v2.21.0-rc2/t/t7300-clean.sh#L408-L417\n\nI actually doubt that `git clean` ignores `core.excludesFile`: in\nhttps://github.com/git/git/blob/v2.21.0-rc2/config.c#L1297-L1298,\n`git_default_core_config()` (which is called via the `git_clean_config()`\n-> `git_color_default_config()` -> `git_default_config()` chain from\n`cmd_clean()`) does interpret `core.excludesFile`:\n\n\tif (!strcmp(var, \"core.excludesfile\"))\n\t\treturn git_config_pathname(&excludes_file, var, value);\n\nThen, `cmd_clean()` goes on to parse the options, setting the `ignored`\nvariable upon `-x` and then doing\n[this](https://github.com/git/git/blob/v2.21.0-rc2/builtin/clean.c#L957-L958):\n\n\tif (!ignored)\n\t\tsetup_standard_excludes(&dir);\n\nThis function specifically looks at `excludes_file` in\nhttps://github.com/git/git/blob/v2.21.0-rc2/dir.c#L2481-L2483:\n\n\tif (excludes_file && !access_or_warn(excludes_file, R_OK, 0))\n\t\tadd_excludes_from_file_1(dir, excludes_file,\n\t\t\t\t\t dir->untracked ? &dir->ss_excludes_file : NULL);\n\nSo I am quite puzzled by the claim that `git clean` might not consult\n`core.excludesFile`.\n\nRobert, care to come up with an example demonstrating where it does not?\n\nCiao,\nJohannes\n"},{"id":"370029","messageId":"alpine.LFD.2.21.1902231328560.2222@localhost.localdomain","threadId":"50571","inReplyTo":"nycvar.QRO.7.76.6.1902231912370.45@tvgsbejvaqbjf.bet","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2019-02-23T18:32:16Z","receivedAt":"2019-02-23T18:32:23Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"On Sat, 23 Feb 2019, Johannes Schindelin wrote:\n\n> Hi,\n>\n> On Sat, 23 Feb 2019, Johannes Schindelin wrote:\n>\n> > On Sat, 23 Feb 2019, Junio C Hamano wrote:\n> >\n> > > \"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n> > >\n> > > >   am i misreading something? and if not, is there a reason git clean\n> > > > does not consult core.excludesFile?\n> > >\n> > > Can you ask \"git log\" and \"git blame\" whch of  core.excludesFile and\n> > > \"clean -x\" features came earlier and by how big a difference?\n> >\n> > Or maybe we can have a look why the `core.excludesfile` regression test\n> > case in t7300 does not catch this?\n> >\n> > https://github.com/git/git/blob/v2.21.0-rc2/t/t7300-clean.sh#L408-L417\n>\n> I actually doubt that `git clean` ignores `core.excludesFile`: in\n> https://github.com/git/git/blob/v2.21.0-rc2/config.c#L1297-L1298,\n> `git_default_core_config()` (which is called via the `git_clean_config()`\n> -> `git_color_default_config()` -> `git_default_config()` chain from\n> `cmd_clean()`) does interpret `core.excludesFile`:\n>\n> \tif (!strcmp(var, \"core.excludesfile\"))\n> \t\treturn git_config_pathname(&excludes_file, var, value);\n>\n> Then, `cmd_clean()` goes on to parse the options, setting the `ignored`\n> variable upon `-x` and then doing\n> [this](https://github.com/git/git/blob/v2.21.0-rc2/builtin/clean.c#L957-L958):\n>\n> \tif (!ignored)\n> \t\tsetup_standard_excludes(&dir);\n>\n> This function specifically looks at `excludes_file` in\n> https://github.com/git/git/blob/v2.21.0-rc2/dir.c#L2481-L2483:\n>\n> \tif (excludes_file && !access_or_warn(excludes_file, R_OK, 0))\n> \t\tadd_excludes_from_file_1(dir, excludes_file,\n> \t\t\t\t\t dir->untracked ? &dir->ss_excludes_file : NULL);\n>\n> So I am quite puzzled by the claim that `git clean` might not consult\n> `core.excludesFile`.\n>\n> Robert, care to come up with an example demonstrating where it does not?\n\n  sorry i wasn't clear, all i was pointing out was that \"man\ngit-clean\" *explicitly* mentioned two locations related to cleaning:\n\n  -x\n        Don’t use the standard ignore rules read from .gitignore\n        (per directory) and $GIT_DIR/info/exclude, ...\n\nwithout additionally *explicitly* mentioning core.excludesFile. if the\nman page simply said something like, \"using the standard ignore\nprocessing\" and left it at that, it would be fine, but to list two of\nthe locations without the third is potentially confusing.\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                  http://crashcourse.ca/dokuwiki\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================"},{"id":"370050","messageId":"xmqq5zt9oirx.fsf@gitster-ct.c.googlers.com","threadId":"50571","inReplyTo":"alpine.LFD.2.21.1902231328560.2222@localhost.localdomain","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-02-24T05:30:26Z","receivedAt":"2019-02-24T05:30:30Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n\n> On Sat, 23 Feb 2019, Johannes Schindelin wrote:\n>\n>> Robert, care to come up with an example demonstrating where it does not?\n>\n>   sorry i wasn't clear, all i was pointing out was that \"man\n> git-clean\" *explicitly* mentioned two locations related to cleaning:\n> ...\n> without additionally *explicitly* mentioning core.excludesFile.\n\nOK, so together with the homework Dscho did for you and what I wrote\nearlier, I think you have enough information to answer the question\nyourself.\n\nThat is, the code does *not* ignore, and the doc was trying to be\n(overly) exhaustive but because it predates core.excludesFile, after\nthe introduction of that configuration, it no longer is exhaustigve\nand has become stale.\n\nWhich would leave a small, easy and low-hanging fruit, I guess ;-).\n\nThanks.\n"},{"id":"370086","messageId":"nycvar.QRO.7.76.6.1902241515120.45@tvgsbejvaqbjf.bet","threadId":"50571","inReplyTo":"xmqq5zt9oirx.fsf@gitster-ct.c.googlers.com","subject":"Re: does \"git clean\" deliberately ignore \"core.excludesFile\"?","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-02-24T14:15:45Z","receivedAt":"2019-02-24T14:21:08Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Sat, 23 Feb 2019, Junio C Hamano wrote:\n\n> \"Robert P. J. Day\" <rpjday@crashcourse.ca> writes:\n> \n> > On Sat, 23 Feb 2019, Johannes Schindelin wrote:\n> >\n> >> Robert, care to come up with an example demonstrating where it does not?\n> >\n> >   sorry i wasn't clear, all i was pointing out was that \"man\n> > git-clean\" *explicitly* mentioned two locations related to cleaning:\n> > ...\n> > without additionally *explicitly* mentioning core.excludesFile.\n> \n> OK, so together with the homework Dscho did for you and what I wrote\n> earlier, I think you have enough information to answer the question\n> yourself.\n> \n> That is, the code does *not* ignore, and the doc was trying to be\n> (overly) exhaustive but because it predates core.excludesFile, after\n> the introduction of that configuration, it no longer is exhaustigve\n> and has become stale.\n> \n> Which would leave a small, easy and low-hanging fruit, I guess ;-).\n\n#leftoverbits\n\n;-)\n\nThanks,\nDscho\n\n> Thanks.\n> \n"}]}