{"thread":{"id":"47175","subject":"more pedantry ... what means a file \"known to Git\"?","startedAt":"2017-11-12T09:49:10Z","lastAt":"2017-11-13T15:34:13Z","messageCount":2,"participants":["Robert P. J. Day","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"332314","messageId":"alpine.LFD.2.21.1711120430580.30032@localhost.localdomain","threadId":"47175","inReplyTo":null,"subject":"more pedantry ... what means a file \"known to Git\"?","fromName":"Robert P. J. Day","fromEmail":"rpjday@crashcourse.ca","sentAt":"2017-11-12T09:48:40Z","receivedAt":"2017-11-12T09:49:10Z","isPatch":false,"sender":{"key":"rpjday@crashcourse.ca","avatar":"https://avatars.githubusercontent.com/u/226084077?v=4"},"body":"\n  apologies for more excruciating nitpickery, but i ask since it seems\nthat phrase means slightly different things depending on where you\nread it.\n\n  first, i assume that there are only two categories:\n\n  1) files known to Git\n  2) files unknown to Git\n\nand that there is no fuzzy, grey area middle ground, yes?\n\n  now, in \"man git-clean\", one reads (near the top):\n\n    Cleans the working tree by recursively removing files that are\n    not under version control, starting from the current directory.\n\n    Normally, only files unknown to Git are removed, but if the -x\n              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    option is specified, ignored files are also removed.\n\nthe way that's worded suggests that ignored files are \"known\" to Git,\nyes? that is, if, by default, \"git clean\" removes only files \"unknown\"\nto Git, and \"-x\" extends that to ignored files, the conclusion is that\nignored files are *known* to Git.\n\n  if, however, you check out \"man git-rm\", you read:\n\n    The <file> list given to the command can be exact pathnames,\n    file glob patterns, or leading directory names. The command\n    removes only the paths that are known to Git. Giving the name\n                                    ^^^^^^^^^^^^\n    of a file that you have not told Git about does not remove that file.\n\nso \"git rm\" removes only files \"known to Git\", but from the above\nregarding how \"git clean\" sees this, that should include ignored\nfiles, which of course it doesn't.\n\n  given that this phrase occurs in a number of places:\n\n$ grep -ir \"known to git\" *\nbuiltin/difftool.c:\t\t/* The symlink is unknown to Git so read from the filesystem */\ndir.c:\t\terror(\"pathspec '%s' did not match any file(s) known to git.\",\nDocumentation/git-rm.txt:removes only the paths that are known to Git.  Giving the name of\nDocumentation/git-commit.txt:   be known to Git);\nDocumentation/user-manual.txt:error: pathspec '261dfac35cb99d380eb966e102c1197139f7fa24' did not match any file(s) known to git.\nDocumentation/gitattributes.txt:\tNotice all types of potential whitespace errors known to Git.\nDocumentation/git-clean.txt:Normally, only files unknown to Git are removed, but if the `-x`\nDocumentation/RelNotes/1.8.2.1.txt: * The code to keep track of what directory names are known to Git on\nDocumentation/RelNotes/1.8.1.6.txt: * The code to keep track of what directory names are known to Git on\nDocumentation/RelNotes/2.9.0.txt:   known to Git.  They have been taught to do the normalization.\nDocumentation/RelNotes/2.8.4.txt:   known to Git.  They have been taught to do the normalization.\nDocumentation/RelNotes/1.8.3.txt: * The code to keep track of what directory names are known to Git on\nt/t3005-ls-files-relative.sh:\t\t\techo \"error: pathspec $sq$f$sq did not match any file(s) known to git.\"\nt/t3005-ls-files-relative.sh:\t\t\techo \"error: pathspec $sq$f$sq did not match any file(s) known to git.\"\n$\n\nit might be useful to define precisely what it means. or is it assumed\nto be context dependent?\n\nrday\n\n-- \n\n========================================================================\nRobert P. J. Day                                 Ottawa, Ontario, CANADA\n                        http://crashcourse.ca\n\nTwitter:                                       http://twitter.com/rpjday\nLinkedIn:                               http://ca.linkedin.com/in/rpjday\n========================================================================\n"},{"id":"332419","messageId":"EEC5BA1D5F274F02AE20FC269868FDEF@PhilipOakley","threadId":"47175","inReplyTo":"alpine.LFD.2.21.1711120430580.30032@localhost.localdomain","subject":"Re: more pedantry ... what means a file \"known to Git\"?","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2017-11-13T15:34:13Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Robert P. J. Day\" <rpjday@crashcourse.ca>\n>\n>  apologies for more excruciating nitpickery, but i ask since it seems\n> that phrase means slightly different things depending on where you\n> read it.\n>\n>  first, i assume that there are only two categories:\n>\n>  1) files known to Git\n>  2) files unknown to Git\n>\n> and that there is no fuzzy, grey area middle ground, yes?\n\nsort of...\n>\n>  now, in \"man git-clean\", one reads (near the top):\n>\n>    Cleans the working tree by recursively removing files that are\n>    not under version control, starting from the current directory.\n>\n>    Normally, only files unknown to Git are removed, but if the -x\n>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n>    option is specified, ignored files are also removed.\n>\n> the way that's worded suggests that ignored files are \"known\" to Git,\n> yes?\n\nYou've hit the three way binary problem of +1, 0, -1 ! The lsb is still 0 or \n1, but we have the two assertions of:\nPositively known to git -- added to the index and the object store\nNegatively 'known' to git -- paths we actively ignore, thus not in the index \nor object store.\n\nUnknown files are those that could be added.\n\n>  that is, if, by default, \"git clean\" removes only files \"unknown\"\n> to Git, and \"-x\" extends that to ignored files, the conclusion is that\n> ignored files are *known* to Git.\n\nbut only in a negative sense ...\n\n>\n>  if, however, you check out \"man git-rm\", you read:\n>\n>    The <file> list given to the command can be exact pathnames,\n>    file glob patterns, or leading directory names. The command\n>    removes only the paths that are known to Git. Giving the name\n>                                    ^^^^^^^^^^^^\n>    of a file that you have not told Git about does not remove that file.\n>\n> so \"git rm\" removes only files \"known to Git\", but from the above\n> regarding how \"git clean\" sees this, that should include ignored\n> files, which of course it doesn't.\n\nThe man page description starts with the key \"Remove files from the index\", \nso this is the positive 'knowing' part. Clearly it can never remove other \nignored files as they can't be in the index (but note the 'other' caveat. \nP->Q # Q->P).\n\n>\n>  given that this phrase occurs in a number of places:\n>\n> $ grep -ir \"known to git\" *\n> builtin/difftool.c: /* The symlink is unknown to Git so read from the \n> filesystem */\n> dir.c: error(\"pathspec '%s' did not match any file(s) known to git.\",\n> Documentation/git-rm.txt:removes only the paths that are known to Git. \n> Giving the name of\n> Documentation/git-commit.txt:   be known to Git);\n> Documentation/user-manual.txt:error: pathspec \n> '261dfac35cb99d380eb966e102c1197139f7fa24' did not match any file(s) known \n> to git.\n> Documentation/gitattributes.txt: Notice all types of potential whitespace \n> errors known to Git.\n> Documentation/git-clean.txt:Normally, only files unknown to Git are \n> removed, but if the `-x`\n> Documentation/RelNotes/1.8.2.1.txt: * The code to keep track of what \n> directory names are known to Git on\n> Documentation/RelNotes/1.8.1.6.txt: * The code to keep track of what \n> directory names are known to Git on\n> Documentation/RelNotes/2.9.0.txt:   known to Git.  They have been taught \n> to do the normalization.\n> Documentation/RelNotes/2.8.4.txt:   known to Git.  They have been taught \n> to do the normalization.\n> Documentation/RelNotes/1.8.3.txt: * The code to keep track of what \n> directory names are known to Git on\n> t/t3005-ls-files-relative.sh: echo \"error: pathspec $sq$f$sq did not match \n> any file(s) known to git.\"\n> t/t3005-ls-files-relative.sh: echo \"error: pathspec $sq$f$sq did not match \n> any file(s) known to git.\"\n> $\n>\n> it might be useful to define precisely what it means. or is it assumed\n> to be context dependent?\n\n\nA little bit of clarification may be useful. You can't be/aren't the only \none who is willing to note these subtle inconsistencies (Git knows things \nvia the index (staging area) and the object store (repository)).\n>\n> rday\n--\nPhilip================= \n\n"}]}