{"thread":{"id":"25117","subject":"ls-files --exclude broken?","startedAt":"2010-09-15T22:40:20Z","lastAt":"2010-09-16T00:51:24Z","messageCount":17,"participants":["Jay Soffian","Nguyen Thai Ngoc Duy","Junio C Hamano","Kevin Ballard","Daniel Johnson","Elijah Newren","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"150765","messageId":"AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com","threadId":"25117","inReplyTo":null,"subject":"ls-files --exclude broken?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-15T22:40:20Z","receivedAt":"2010-09-15T22:40:20Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Am I missing something really obvious here?\n\nkore:~/Repos/git (master)$ git ls-files | wc -l\n    2009\nkore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n    2009\nkore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n    2009\nkore:~/Repos/git (master)$ git version\ngit version 1.7.3.rc1.5.g95127\n\nj.\n"},{"id":"150767","messageId":"AANLkTinW3ugUK6uBq6oFOzKorHubP-oi9KwJzsNrgpE4@mail.gmail.com","threadId":"25117","inReplyTo":"AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-09-15T23:06:36Z","receivedAt":"2010-09-15T23:06:36Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Sep 16, 2010 at 8:40 AM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> Am I missing something really obvious here?\n>\n> kore:~/Repos/git (master)$ git ls-files | wc -l\n>    2009\n> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>    2009\n> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>    2009\n> kore:~/Repos/git (master)$ git version\n> git version 1.7.3.rc1.5.g95127\n\nexcluded() is not called as far as I can tell, which explains why it\ndid not exclude anything for you. That exclude code was touched by\nJeff in commits b5227d8 (ls-files: excludes should not impact tracked\nfiles) and 500348a (ls-files: unbreak \"ls-files -i\").\n\nSomething like this works for me, but I haven't finished my morning\ntea yet, so..\n\ndiff --git a/builtin/ls-files.c b/builtin/ls-files.c\nindex bb4f612..ab87843 100644\n--- a/builtin/ls-files.c\n+++ b/builtin/ls-files.c\n@@ -216,9 +216,14 @@ static void show_files(struct dir_struct *dir)\n \t\tfor (i = 0; i < active_nr; i++) {\n \t\t\tstruct cache_entry *ce = active_cache[i];\n \t\t\tint dtype = ce_to_dtype(ce);\n-\t\t\tif (dir->flags & DIR_SHOW_IGNORED &&\n-\t\t\t    !excluded(dir, ce->name, &dtype))\n-\t\t\t\tcontinue;\n+\t\t\tif (dir->flags & DIR_SHOW_IGNORED) {\n+\t\t\t\tif (!excluded(dir, ce->name, &dtype))\n+\t\t\t\t\tcontinue;\n+\t\t\t}\n+\t\t\telse {\n+\t\t\t\tif (excluded(dir, ce->name, &dtype))\n+\t\t\t\t\tcontinue;\n+\t\t\t}\n \t\t\tif (show_unmerged && !ce_stage(ce))\n \t\t\t\tcontinue;\n \t\t\tif (ce->ce_flags & CE_UPDATE)\n-- \nDuy\n"},{"id":"150768","messageId":"7v62y661pl.fsf@alter.siamese.dyndns.org","threadId":"25117","inReplyTo":"AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-15T23:12:22Z","receivedAt":"2010-09-15T23:12:22Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> Am I missing something really obvious here?\n>\n> kore:~/Repos/git (master)$ git ls-files | wc -l\n>     2009\n\nYou asked it to show the cached paths (default).  Your project currently\ntracks 2009 paths in the index.\n\n> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>     2009\n\nYou told that '*' is the exclude pattern for carrying out some operation,\nbut you didn't tell what operation you want.  You are shown the cached\npaths (default).\n\n> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>     2009\n\nYou told that '*' is the exclude pattern, you want only paths that match\nthe exclude pattern, and chose to show files in the index (which again is\nthe default) by not saying -o.\n\nI've never found -i useful myself (actually I don't find many options the\ncommand has very useful anymore), but the above is how I read the ls-files\nmanual page.\n"},{"id":"150771","messageId":"AANLkTimYNtU7sHn4_Vx50evTWDpMK_=XgshU3ZzT+eVw@mail.gmail.com","threadId":"25117","inReplyTo":"7v62y661pl.fsf@alter.siamese.dyndns.org","subject":"Re: ls-files --exclude broken?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-15T23:19:28Z","receivedAt":"2010-09-15T23:19:28Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Sep 15, 2010 at 7:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Am I missing something really obvious here?\n>>\n>> kore:~/Repos/git (master)$ git ls-files | wc -l\n>>     2009\n>\n> You asked it to show the cached paths (default).  Your project currently\n> tracks 2009 paths in the index.\n\nCorrect.\n\n>> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>>     2009\n>\n> You told that '*' is the exclude pattern for carrying out some operation,\n> but you didn't tell what operation you want.  You are shown the cached\n> paths (default).\n\nI want cached paths, minus the exclude pattern. Using -c -x \\* gives\nthe same result.\n\nThere is no indication in the man page that -x doesn't apply to -c.\n\n>> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>>     2009\n>\n> You told that '*' is the exclude pattern, you want only paths that match\n> the exclude pattern, and chose to show files in the index (which again is\n> the default) by not saying -o.\n>\n> I've never found -i useful myself (actually I don't find many options the\n> command has very useful anymore), but the above is how I read the ls-files\n> manual page.\n\nI don't care about -i myself, and maybe I should have been clearer.\nAFAICT, [-c] -x is broken:\n\n$ git ls-files -c -x \\* |wc -l\n    2009\n\n       -c, --cached\n           Show cached files in the output (default)\n\n       -x <pattern>, --exclude=<pattern>\n           Skips files matching pattern. Note that pattern is a shell\nwildcard pattern.\n\nOh, geez, here it is lower down in the man page:\n\n  git ls-files can use a list of \"exclude patterns\" when traversing\nthe directory tree and finding files to show when the flags --others\nor --ignored are specified. gitignore(5) specifies the format of\nexclude patterns.\n\nBah, what use is that? Minimally ls-files shouldn't accept -x unless\ngiven either --ignored or --others if that's all it applies to. I\nguess this is my itch to scratch.\n\nj.\n"},{"id":"150772","messageId":"02BCF40A-6E66-4E19-9235-5EB271F3D685@sb.org","threadId":"25117","inReplyTo":"7v62y661pl.fsf@alter.siamese.dyndns.org","subject":"Re: ls-files --exclude broken?","fromName":"Kevin Ballard","fromEmail":"kevin@sb.org","sentAt":"2010-09-15T23:21:20Z","receivedAt":"2010-09-15T23:21:20Z","isPatch":false,"sender":{"key":"kevin@sb.org","avatar":"https://avatars.githubusercontent.com/u/714?v=4"},"body":"On Sep 15, 2010, at 4:12 PM, Junio C Hamano wrote:\n\n> Jay Soffian <jaysoffian@gmail.com> writes:\n> \n>> Am I missing something really obvious here?\n>> \n>> kore:~/Repos/git (master)$ git ls-files | wc -l\n>>    2009\n> \n> You asked it to show the cached paths (default).  Your project currently\n> tracks 2009 paths in the index.\n> \n>> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>>    2009\n> \n> You told that '*' is the exclude pattern for carrying out some operation,\n> but you didn't tell what operation you want.  You are shown the cached\n> paths (default).\n> \n>> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>>    2009\n> \n> You told that '*' is the exclude pattern, you want only paths that match\n> the exclude pattern, and chose to show files in the index (which again is\n> the default) by not saying -o.\n> \n> I've never found -i useful myself (actually I don't find many options the\n> command has very useful anymore), but the above is how I read the ls-files\n> manual page.\n\nMy impression is that -x is pretty much only useful when you're using the -o flag, as anything that's already tracked isn't supposed to be affected by exclude patterns. The argument can be made that ls-files should indeed apply the exclude pattern to other requested display modes, and in fact a reading of the -i switch seems to imply that it should. Running `git ls-files -x '*.m' -c -i` displays all files ending in .m in the index. It would seem logical that the similar `git ls-files -x '*.m' -c` should display all files that don't end in .m in the index, but it doesn't appear to apply the exclude pattern in this case. As for -i being useful, I've never actually used it myself (though obviously it can be used as a way to grep through the index via the exclude pattern), but I can imagine a \n scenario where I want to clean up all untracked files and end up running something like `git ls-files -z -o -i --exclude-standard | xargs -0 rm`.\n\n-Kevin Ballard"},{"id":"150773","messageId":"AANLkTik7ORPUsABJv-bFraFNt2TvP0Xx=-013P2=A6Nr@mail.gmail.com","threadId":"25117","inReplyTo":"AANLkTimYNtU7sHn4_Vx50evTWDpMK_=XgshU3ZzT+eVw@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2010-09-15T23:29:58Z","receivedAt":"2010-09-15T23:29:58Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Sep 16, 2010 at 9:19 AM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> On Wed, Sep 15, 2010 at 7:12 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Am I missing something really obvious here?\n>>>\n>>> kore:~/Repos/git (master)$ git ls-files | wc -l\n>>>     2009\n>>\n>> You asked it to show the cached paths (default).  Your project currently\n>> tracks 2009 paths in the index.\n>\n> Correct.\n>\n>>> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>>>     2009\n>>\n>> You told that '*' is the exclude pattern for carrying out some operation,\n>> but you didn't tell what operation you want.  You are shown the cached\n>> paths (default).\n>\n> I want cached paths, minus the exclude pattern. Using -c -x \\* gives\n> the same result.\n>\n> There is no indication in the man page that -x doesn't apply to -c.\n>\n>>> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>>>     2009\n>>\n>> You told that '*' is the exclude pattern, you want only paths that match\n>> the exclude pattern, and chose to show files in the index (which again is\n>> the default) by not saying -o.\n>>\n>> I've never found -i useful myself (actually I don't find many options the\n>> command has very useful anymore), but the above is how I read the ls-files\n>> manual page.\n>\n> I don't care about -i myself, and maybe I should have been clearer.\n> AFAICT, [-c] -x is broken:\n>\n> $ git ls-files -c -x \\* |wc -l\n>    2009\n>\n>       -c, --cached\n>           Show cached files in the output (default)\n>\n>       -x <pattern>, --exclude=<pattern>\n>           Skips files matching pattern. Note that pattern is a shell\n> wildcard pattern.\n>\n> Oh, geez, here it is lower down in the man page:\n>\n>  git ls-files can use a list of \"exclude patterns\" when traversing\n> the directory tree and finding files to show when the flags --others\n> or --ignored are specified. gitignore(5) specifies the format of\n> exclude patterns.\n>\n> Bah, what use is that? Minimally ls-files shouldn't accept -x unless\n> given either --ignored or --others if that's all it applies to. I\n> guess this is my itch to scratch.\n\nI sense another use of negative pathspecs here..\n-- \nDuy\n"},{"id":"150774","messageId":"201009151931.23482.ComputerDruid@gmail.com","threadId":"25117","inReplyTo":"AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Daniel Johnson","fromEmail":"computerdruid@gmail.com","sentAt":"2010-09-15T23:31:16Z","receivedAt":"2010-09-15T23:31:16Z","isPatch":false,"sender":{"key":"computerdruid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/34696?v=4"},"body":"On Wednesday 15 September 2010 18:40:20 Jay Soffian wrote:\n> Am I missing something really obvious here?\n> kore:~/Repos/git (master)$ git ls-files | wc -l\n>     2009\n> kore:~/Repos/git (master)$ git ls-files -x \\* | wc -l\n>     2009\n> kore:~/Repos/git (master)$ git ls-files -i -x \\* | wc -l\n>     2009\n> kore:~/Repos/git (master)$ git version\n> git version 1.7.3.rc1.5.g95127\n\nFor fun, I bisected this. This behavior changed in the following commit. \nBefore this, it worked as you expected. The other replies seem to explain this \nmore.\n\nb5227d80aee5173bfda6aa43a890d03110b0df26 is the first bad commit\ncommit b5227d80aee5173bfda6aa43a890d03110b0df26\nAuthor: Jeff King <peff@peff.net>\nDate:   Mon Oct 12 01:11:57 2009 -0400\n\n    ls-files: excludes should not impact tracked files\n    \n    In all parts of git, .gitignore and other exclude files\n    impact only how we treat untracked files; they should have\n    no effect on files listed in the index.\n    \n    This behavior was originally implemented very early on in\n    9ff768e, but only for --exclude-from. Later, commit 63d285c\n    accidentally caused us to trigger the behavior for\n    --exclude-per-directory.\n    \n    This patch totally ignores excludes for files found in the\n    index. This means we are reversing the original intent of\n    9ff768e, while at the same time fixing the accidental\n    behavior of 63d285c. This is a good thing, though, as the\n    way that 9ff768e behaved does not really make sense with the\n    way exclusions are used in modern git.\n    \n    Signed-off-by: Jeff King <peff@peff.net>\n    Signed-off-by: Junio C Hamano <gitster@pobox.com>\n"},{"id":"150775","messageId":"AANLkTi=FePrE6gpwiaxqDfw0f7Jk=mb-sTe-XR6-sKXM@mail.gmail.com","threadId":"25117","inReplyTo":"AANLkTimYNtU7sHn4_Vx50evTWDpMK_=XgshU3ZzT+eVw@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2010-09-15T23:34:43Z","receivedAt":"2010-09-15T23:34:43Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"On Wed, Sep 15, 2010 at 5:19 PM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> I want cached paths, minus the exclude pattern. Using -c -x \\* gives\n> the same result.\n>\n> There is no indication in the man page that -x doesn't apply to -c.\n\nThat caught me too.\n\n<snip>\n> Bah, what use is that? Minimally ls-files shouldn't accept -x unless\n> given either --ignored or --others if that's all it applies to. I\n> guess this is my itch to scratch.\n\nI ran into the same thing earlier this week and came up with a patch\nsimilar to Nguyen's (though I just restored it closer to what Johannes\noriginally had there), before I discovered that this was an\nintentional change by Jeff.  (And then I tabled it to get back to work\non fixing up merge-recursive some more)\n\nI can't say I really understand the changes from b5227d8 and 500348,\nthough; I found (and find) it confusing as well.  I did notice that\nrestoring the old behavior didn't work very well with items below the\ncurrent directory, so it'd take a bit more work than just restoring\nthe original behavior.\n\n\nElijah\n"},{"id":"150776","messageId":"AANLkTi=L0PA-p5HkWnurfurfyYAQhCBt+Q7SzzCczFLH@mail.gmail.com","threadId":"25117","inReplyTo":"AANLkTik7ORPUsABJv-bFraFNt2TvP0Xx=-013P2=A6Nr@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-15T23:41:50Z","receivedAt":"2010-09-15T23:41:50Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Sep 15, 2010 at 7:29 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> I sense another use of negative pathspecs here..\n\nYeah, I'm really not sure I agree with the reasoning of b5227d8\n(ls-files: excludes should not impact tracked files, 2009-10-12).\n\nI thought about submitting a patch to revert b5227d8, but with an\nadditional option to guard the behavior\n(--exclude-cached-files-too-pretty-please).\n\nBut I guess I don't see the harm in allowing excludes to apply to\ncached files when it is explicitly requested on the command-line. Here\nI think ls-files is slightly different than the other areas of git\nthat don't apply excludes to cached files as it's about, well, listing\nfiles, and it's clear (I think) what the user wants.\n\nBut I'll go dig in the mailing list archives now to see if I can find\nwhat motivated Jeff's change beyond what he gave in the commit\nmessage.\n\nj.\n"},{"id":"150777","messageId":"AANLkTimPFvRie8oMErD_X503gfiu=f8_O7JqK9KRznRe@mail.gmail.com","threadId":"25117","inReplyTo":"AANLkTi=L0PA-p5HkWnurfurfyYAQhCBt+Q7SzzCczFLH@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-15T23:47:30Z","receivedAt":"2010-09-15T23:47:30Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Sep 15, 2010 at 7:41 PM, Jay Soffian <jaysoffian@gmail.com> wrote:\n> But I'll go dig in the mailing list archives now to see if I can find\n> what motivated Jeff's change beyond what he gave in the commit\n> message.\n\nhttp://thread.gmane.org/gmane.comp.version-control.git/129889/focus=129976\n\nHmm.\n\nj.\n"},{"id":"150778","messageId":"1284595008-36464-1-git-send-email-jaysoffian@gmail.com","threadId":"25117","inReplyTo":"AANLkTimuTHvA+qjqpmz=VkCpTTiRA7imb5+ZyTVmPwYy@mail.gmail.com","subject":"[PATCH] git-ls-files.txt: clarify -x/--exclude option","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-15T23:56:48Z","receivedAt":"2010-09-15T23:56:48Z","isPatch":true,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"Since b5227d8, -x/--exclude does not apply to cached files.\nThis is easy to miss unless you read the discussion in the\nEXCLUDE PATTERNS section. Clarify that the option applies\nto untracked files and direct the reader to EXCLUDE PATTERNS.\n\nSigned-off-by: Jay Soffian <jaysoffian@gmail.com>\n---\n Documentation/git-ls-files.txt |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\nWell, at least we can clarify the man page to reduce likelihood\nof future confusion.\n\ndiff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\nindex 15aee2f..f52b06a 100644\n--- a/Documentation/git-ls-files.txt\n+++ b/Documentation/git-ls-files.txt\n@@ -79,8 +79,9 @@ OPTIONS\n \n -x <pattern>::\n --exclude=<pattern>::\n-\tSkips files matching pattern.\n-\tNote that pattern is a shell wildcard pattern.\n+\tSkips untracked files matching pattern.\n+\tNote that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS\n+\tbelow for more information.\n \n -X <file>::\n --exclude-from=<file>::\n-- \n1.7.3.rc1.5.g95127\n"},{"id":"150780","messageId":"20100916001636.GA2371@sigill.intra.peff.net","threadId":"25117","inReplyTo":"AANLkTi=L0PA-p5HkWnurfurfyYAQhCBt+Q7SzzCczFLH@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-09-16T00:16:36Z","receivedAt":"2010-09-16T00:16:36Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 15, 2010 at 07:41:50PM -0400, Jay Soffian wrote:\n\n> On Wed, Sep 15, 2010 at 7:29 PM, Nguyen Thai Ngoc Duy <pclouds@gmail.com> wrote:\n> > I sense another use of negative pathspecs here..\n> \n> Yeah, I'm really not sure I agree with the reasoning of b5227d8\n> (ls-files: excludes should not impact tracked files, 2009-10-12).\n> \n> I thought about submitting a patch to revert b5227d8, but with an\n> additional option to guard the behavior\n> (--exclude-cached-files-too-pretty-please).\n> \n> But I guess I don't see the harm in allowing excludes to apply to\n> cached files when it is explicitly requested on the command-line. Here\n> I think ls-files is slightly different than the other areas of git\n> that don't apply excludes to cached files as it's about, well, listing\n> files, and it's clear (I think) what the user wants.\n\nIt's not just the command line. It's also what's in .gitignore files. If\nyou disable just half of that, then you get the awful behavior that some\nexcludes apply to index files, and some don't.\n\nYes, it's confusing that \"-i\" is not actually an inversion for index\nfiles. See\n\n  http://article.gmane.org/gmane.comp.version-control.git/131719\n\nIt would help if I understood exactly what you're trying to accomplish.\n\n-Peff\n"},{"id":"150781","messageId":"20100916001909.GB2371@sigill.intra.peff.net","threadId":"25117","inReplyTo":"1284595008-36464-1-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH] git-ls-files.txt: clarify -x/--exclude option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-09-16T00:19:09Z","receivedAt":"2010-09-16T00:19:09Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 15, 2010 at 07:56:48PM -0400, Jay Soffian wrote:\n\n> Since b5227d8, -x/--exclude does not apply to cached files.\n> This is easy to miss unless you read the discussion in the\n> EXCLUDE PATTERNS section. Clarify that the option applies\n> to untracked files and direct the reader to EXCLUDE PATTERNS.\n\nYeah, I think this is a good idea.\n\nAcked-by: Jeff King <peff@peff.net>\n\n-Peff\n"},{"id":"150783","messageId":"AANLkTikd5uZFk8-d7wmB8ZEqOy5=RWsDNnrsHqAQZhkz@mail.gmail.com","threadId":"25117","inReplyTo":"20100916001636.GA2371@sigill.intra.peff.net","subject":"Re: ls-files --exclude broken?","fromName":"Jay Soffian","fromEmail":"jaysoffian@gmail.com","sentAt":"2010-09-16T00:33:29Z","receivedAt":"2010-09-16T00:33:29Z","isPatch":false,"sender":{"key":"jaysoffian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/155970?v=4"},"body":"On Wed, Sep 15, 2010 at 8:16 PM, Jeff King <peff@peff.net> wrote:\n> It's not just the command line. It's also what's in .gitignore files. If\n> you disable just half of that, then you get the awful behavior that some\n> excludes apply to index files, and some don't.\n\nFiles matched by the standard excludes are not likely to be in the\nindex in the first place. So in that sense, arguably -x is special.\n\nBut nonetheless, I agree with you, and since the user must\nspecifically ask ls-files for the various exclusions, I think it makes\nsense to apply those even to cached files.\n\n> It would help if I understood exactly what you're trying to accomplish.\n\nI'm building a project file for my editor and I want to exclude\ncertain files that make no sense for it to care about even though they\nare part of the repo. So I tried:\n\n$ git ls-files -x png -x jpg ...\n\nand was confused by that not working. I've worked around this by just\nfiltering the ls-files output through grep, but, ick.\n\nj.\n"},{"id":"150784","messageId":"7v1v8u5xkf.fsf@alter.siamese.dyndns.org","threadId":"25117","inReplyTo":"1284595008-36464-1-git-send-email-jaysoffian@gmail.com","subject":"Re: [PATCH] git-ls-files.txt: clarify -x/--exclude option","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-09-16T00:41:52Z","receivedAt":"2010-09-16T00:41:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jay Soffian <jaysoffian@gmail.com> writes:\n\n> diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\n> index 15aee2f..f52b06a 100644\n> --- a/Documentation/git-ls-files.txt\n> +++ b/Documentation/git-ls-files.txt\n> @@ -79,8 +79,9 @@ OPTIONS\n>  \n>  -x <pattern>::\n>  --exclude=<pattern>::\n> -\tSkips files matching pattern.\n> -\tNote that pattern is a shell wildcard pattern.\n> +\tSkips untracked files matching pattern.\n> +\tNote that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS\n> +\tbelow for more information.\n\nWould be helpful; will queue directly on top of 500348a.\n\nThanks\n\nBy the way, I think the language in that file needs a bit of tweaking for\nreadability.  Perhaps this on top of your patch...\n\n-- >8 --\nSubject: [PATCH] ls-files documentation: reword for consistency\n\nSimilar to descriptions of other options, state what -x does in imperative\nmood.  Start sentences for -X and --exclude-per-directory options in\ncapital letters.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n Documentation/git-ls-files.txt |    8 ++++----\n 1 files changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt\nindex c05e7a5..44b6480 100644\n--- a/Documentation/git-ls-files.txt\n+++ b/Documentation/git-ls-files.txt\n@@ -79,16 +79,16 @@ OPTIONS\n \n -x <pattern>::\n --exclude=<pattern>::\n-\tSkips untracked files matching pattern.\n+\tSkip untracked files matching pattern.\n \tNote that pattern is a shell wildcard pattern. See EXCLUDE PATTERNS\n \tbelow for more information.\n \n -X <file>::\n --exclude-from=<file>::\n-\texclude patterns are read from <file>; 1 per line.\n+\tRead exclude patterns from <file>; 1 per line.\n \n --exclude-per-directory=<file>::\n-\tread additional exclude patterns that apply only to the\n+\tRead additional exclude patterns that apply only to the\n \tdirectory and its subdirectories in <file>.\n \n --exclude-standard::\n@@ -178,7 +178,7 @@ These exclude patterns come from these places, in order:\n      file containing a list of patterns.  Patterns are ordered\n      in the same order they appear in the file.\n \n-  3. command line flag --exclude-per-directory=<name> specifies\n+  3. The command line flag --exclude-per-directory=<name> specifies\n      a name of the file in each directory 'git-ls-files'\n      examines, normally `.gitignore`.  Files in deeper\n      directories take precedence.  Patterns are ordered in the\n-- \n1.7.3.rc2.221.gbf93f\n"},{"id":"150785","messageId":"20100916005024.GA3428@sigill.intra.peff.net","threadId":"25117","inReplyTo":"AANLkTikd5uZFk8-d7wmB8ZEqOy5=RWsDNnrsHqAQZhkz@mail.gmail.com","subject":"Re: ls-files --exclude broken?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-09-16T00:50:24Z","receivedAt":"2010-09-16T00:50:24Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 15, 2010 at 08:33:29PM -0400, Jay Soffian wrote:\n\n> On Wed, Sep 15, 2010 at 8:16 PM, Jeff King <peff@peff.net> wrote:\n> > It's not just the command line. It's also what's in .gitignore files. If\n> > you disable just half of that, then you get the awful behavior that some\n> > excludes apply to index files, and some don't.\n> \n> Files matched by the standard excludes are not likely to be in the\n> index in the first place. So in that sense, arguably -x is special.\n> \n> But nonetheless, I agree with you, and since the user must\n> specifically ask ls-files for the various exclusions, I think it makes\n> sense to apply those even to cached files.\n\nBut then if somebody asks for both indexed and untracked files together,\nthe behavior is quite confusing. There is no way to say\n\"--exclude-standard just for the untracked files\", and having exclusions\nimpact cached files is unlike any other part of git. So the behavior of\nsomething like \"git ls-files -s -o --exclude-standard\" would be broken.\n\nI have no idea if people are actually doing that.\n\nSo I think the best fix would be to leave the default behavior as-is,\nand add the --exclude-cached-files-too-pretty-please you mentioned.\n\n> I'm building a project file for my editor and I want to exclude\n> certain files that make no sense for it to care about even though they\n> are part of the repo. So I tried:\n> \n> $ git ls-files -x png -x jpg ...\n> \n> and was confused by that not working. I've worked around this by just\n> filtering the ls-files output through grep, but, ick.\n\nI certainly have sympathy for you being confused by the behavior of\nls-files. It undoubtedly is a mess.\n\nBut as for having to use grep, I would feel worse for you if you were\nactually trying to exclude patterns from your .gitignore and you needed\nto _convert_ them into a grep pattern. But it doesn't seem like:\n\n  git ls-files | grep -v '\\.png$'\n\nis really much more work, and it's way more flexible.\n\nAt one point I proposed a \"git check-ignore\" similar to \"git\ncheck-attr\", but I never got around to coding it. If you really liked\nthe gitignore-style patterns for some reason, it would be a nice\nflexible way of doing what you want.\n\n-Peff\n"},{"id":"150786","messageId":"20100916005124.GB3428@sigill.intra.peff.net","threadId":"25117","inReplyTo":"7v1v8u5xkf.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] git-ls-files.txt: clarify -x/--exclude option","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2010-09-16T00:51:24Z","receivedAt":"2010-09-16T00:51:24Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Sep 15, 2010 at 05:41:52PM -0700, Junio C Hamano wrote:\n\n> By the way, I think the language in that file needs a bit of tweaking for\n> readability.  Perhaps this on top of your patch...\n\nAlso an improvement, IMHO.\n\n-Peff\n"}]}