{"thread":{"id":"21954","subject":"b5227d8 changes meaning of \"ls-files -x 'pattern'\"","startedAt":"2009-12-14T15:51:06Z","lastAt":"2009-12-17T12:54:55Z","messageCount":4,"participants":["Sitaram Chamarty","Michael J Gruber","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"129882","messageId":"2e24e5b90912140751y5d769f15pa6782914bdb04dbd@mail.gmail.com","threadId":"21954","inReplyTo":null,"subject":"b5227d8 changes meaning of \"ls-files -x 'pattern'\"","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-12-14T15:51:06Z","receivedAt":"2009-12-14T15:51:06Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"Hello,\n\nBefore b5227d8, the following two commands would produce different\noutputs (say on git.git):\n\n    git ls-files\n    git ls-files -x '*.c'\n\n>From b5227d8 onward, they produce the same output.  The second command\nno longer excludes *.c files.\n\nI was unable to understand the commit message completely but it sounds\nlike this was intentionally changed to do this.\n\nI've never been real clear on ls-files, and was wondering if someone\nwould be able to clarify the various ways of using it, including why\nthis change was made and is there a way (using some other combination of\nflags perhaps) to get a list of files without *.c (to continue this\nexample).\n\nThanks,\n\nSitaram\n"},{"id":"129886","messageId":"4B2664AA.4050204@drmicha.warpmail.net","threadId":"21954","inReplyTo":"2e24e5b90912140751y5d769f15pa6782914bdb04dbd@mail.gmail.com","subject":"Re: b5227d8 changes meaning of \"ls-files -x 'pattern'\"","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-12-14T16:15:38Z","receivedAt":"2009-12-14T16:15:38Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sitaram Chamarty venit, vidit, dixit 14.12.2009 16:51:\n> Hello,\n> \n> Before b5227d8, the following two commands would produce different\n> outputs (say on git.git):\n> \n>     git ls-files\n>     git ls-files -x '*.c'\n> \n> From b5227d8 onward, they produce the same output.  The second command\n> no longer excludes *.c files.\n> \n> I was unable to understand the commit message completely but it sounds\n> like this was intentionally changed to do this.\n\nYes. Generally, git commands never ignore tracked files, and this patch\nreintroduces this for git ls-files\n\n> I've never been real clear on ls-files, and was wondering if someone\n> would be able to clarify the various ways of using it, including why\n> this change was made and is there a way (using some other combination of\n> flags perhaps) to get a list of files without *.c (to continue this\n> example).\n\nYou can still use file glob patterns as the file argument, such as\n\ngit ls-files '*.[^c]'\n\n\nMichael\n"},{"id":"129891","messageId":"20091214182420.GA31594@coredump.intra.peff.net","threadId":"21954","inReplyTo":"2e24e5b90912140751y5d769f15pa6782914bdb04dbd@mail.gmail.com","subject":"Re: b5227d8 changes meaning of \"ls-files -x 'pattern'\"","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-12-14T18:25:26Z","receivedAt":"2009-12-14T18:25:26Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Dec 14, 2009 at 09:21:06PM +0530, Sitaram Chamarty wrote:\n\n> Before b5227d8, the following two commands would produce different\n> outputs (say on git.git):\n> \n>     git ls-files\n>     git ls-files -x '*.c'\n> \n> From b5227d8 onward, they produce the same output.  The second command\n> no longer excludes *.c files.\n>\n> I was unable to understand the commit message completely but it sounds\n> like this was intentionally changed to do this.\n\nYes, it was intentional. Excludes are about untracked files, not about\nrestricting parts of the index. The point of the change was to bring\n\"ls-files\" in harmony with other parts of git. For example, prior to\nb5227d8, you could do:\n\n  $ git init\n  $ echo content >file && git add . && git commit -m base\n  $ echo changes >file\n  $ echo file >.gitignore\n  $ git ls-files --exclude-standard -m\n  <no output>\n  $ git diff-files --name-only\n  file\n\nBut both \"ls-files --exclude-standard\" and \"diff-files\" should\nproduce the same list (and they do post-b5227d8).\n\nHowever, for your use case, I can see the utility of an option to limit\nthe output of ls-files for a particular invocation. It's just that \"-x\"\nis tied into the excludes mechanism, which doesn't do that.\n\nI would not be opposed to a patch to add an option that means \"exclude\nthese index entries from the output list.\" And for the sake of backwards\ncompatibility, it may even be reasonable to call that option \"-x\". The\nchange in b5227d8 was really about ls-files mis-using .gitignore and\n.git/info/exclude; people providing \"-x\" for a particular invocation\nprobably want to limit everything.\n\n-Peff\n"},{"id":"130029","messageId":"2e24e5b90912170454x699ed26fm973e2fb7133b3bbf@mail.gmail.com","threadId":"21954","inReplyTo":"20091214182420.GA31594@coredump.intra.peff.net","subject":"Re: b5227d8 changes meaning of \"ls-files -x 'pattern'\"","fromName":"Sitaram Chamarty","fromEmail":"sitaramc@gmail.com","sentAt":"2009-12-17T12:54:55Z","receivedAt":"2009-12-17T12:54:55Z","isPatch":false,"sender":{"key":"sitaramc@gmail.com","avatar":"https://avatars.githubusercontent.com/u/43316?v=4"},"body":"On Mon, Dec 14, 2009 at 11:55 PM, Jeff King <peff@peff.net> wrote:\n> On Mon, Dec 14, 2009 at 09:21:06PM +0530, Sitaram Chamarty wrote:\n\n>> Before b5227d8, the following two commands would produce different\n>> outputs (say on git.git):\n>>\n>>       git ls-files\n>>       git ls-files -x '*.c'\n>>\n>> From b5227d8 onward, they produce the same output.   The second command\n>> no longer excludes *.c files.\n>>\n>> I was unable to understand the commit message completely but it sounds\n>> like this was intentionally changed to do this.\n\n> Yes, it was intentional. Excludes are about untracked files, not about\n> restricting parts of the index. The point of the change was to bring\n> \"ls-files\" in harmony with other parts of git. For example, prior to\n\nOK; makes sense -- thanks for the explanation.\n\n> However, for your use case, I can see the utility of an option to limit\n> the output of ls-files for a particular invocation. It's just that \"-x\"\n> is tied into the excludes mechanism, which doesn't do that.\n>\n> I would not be opposed to a patch to add an option that means \"exclude\n> these index entries from the output list.\" And for the sake of backwards\n\nI rather doubt if my C skills extend that far these days; I'll figure out\nother ways of doing this if I need it :-)\n\nThanks again,\n\nSitaram\n"}]}