{"thread":{"id":"3460","subject":"[PATCH] git ls files recursively show ignored files","startedAt":"2006-02-24T22:02:34Z","lastAt":"2006-02-24T22:02:34Z","messageCount":1,"participants":["Shawn Pearce"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"16715","messageId":"20060224220234.GB29982@spearce.org","threadId":"3460","inReplyTo":null,"subject":"[PATCH] git ls files recursively show ignored files","fromName":"Shawn Pearce","fromEmail":"spearce@spearce.org","sentAt":"2006-02-24T22:02:34Z","receivedAt":"2006-02-24T22:02:34Z","isPatch":true,"sender":{"key":"spearce@spearce.org","avatar":"https://avatars.githubusercontent.com/u/34844?v=4"},"body":"Make git-ls-files --others --ignored recurse into non-excluded\nsubdirectories.\n\nTypically when asking git-ls-files to display all files which are\nignored by one or more exclude patterns one would want it to recurse\ninto subdirectories which are not themselves excluded to see if\nthere are any excluded files contained within those subdirectories.\n\n---\n I found this issue while trying to find temporary garbage that was\n created within a tracked subdirectory:\n\n   touch a/b/foo#1\n   git-ls-files --others --ignored --exclude='*#1'\n\n would never display a/b/foo#1 as the directory 'a' was not itself\n excluded.  It would be rather nice if git-ls-files actually\n showed it.\n\n ls-files.c |    7 +++++--\n 1 files changed, 5 insertions(+), 2 deletions(-)\n\nbase 98214e96be00c5132047ae80bca20d4690933c33\nlast 809da5f8a21a10112eece4ee9be55fe64371ce68\ndiff --git a/ls-files.c b/ls-files.c\nindex 90b289f03d987c6c90214fc12d00c30b4e28bb27..df25c8c012a96a8277413ca3a81490b81b7dc067 100644\n--- a/ls-files.c\n+++ b/ls-files.c\n@@ -279,8 +279,11 @@ static void read_directory(const char *p\n \t\t\t\tcontinue;\n \t\t\tlen = strlen(de->d_name);\n \t\t\tmemcpy(fullname + baselen, de->d_name, len+1);\n-\t\t\tif (excluded(fullname) != show_ignored)\n-\t\t\t\tcontinue;\n+\t\t\tif (excluded(fullname) != show_ignored) {\n+\t\t\t\tif (!show_ignored || DTYPE(de) != DT_DIR) {\n+\t\t\t\t\tcontinue;\n+\t\t\t\t}\n+\t\t\t}\n \n \t\t\tswitch (DTYPE(de)) {\n \t\t\tstruct stat st;\n-- \n1.2.3.g809d\n"}]}