{"thread":{"id":"4195","subject":"git status and empty directories","startedAt":"2006-05-18T17:57:35Z","lastAt":"2006-05-18T18:29:25Z","messageCount":3,"participants":["Matthias Lederhofer","Linus Torvalds"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"20237","messageId":"E1Fgmkh-0000ur-Hn@moooo.ath.cx","threadId":"4195","inReplyTo":null,"subject":"git status and empty directories","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-05-18T17:57:35Z","receivedAt":"2006-05-18T17:57:35Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"Today I've been working on some source with many empty directories.\ngit-status shows all empty directories under \"Untracked files: (use\n\"git add\" to add to commit)\" but adding is impossible. And if it would\nbe possible to add the directory, because a new file exists in the\ndirectory, it still shows up in the same place, indistinguishable from\nthe empty directories.\n\nThings I could think of to solve this:\n- hide empty directories if the user does not ask explicitly for them\n  with a command line option\n- vice versa: add a command line option to hide empty directories\n(I'd prefer the first one)\n\nAnother category in git-status for empty directories which cannot be\nadded could be interesting too because the comment 'use \"git add\" to\nadd to commit' is quite misleading.\n\nPerhaps there should also be another option to show files in untracked\ndirectories.\n\nAny comments? If a patch would be accepted I'll take a look at\nwriting one. Adding the correct options to git-ls-files seems quite\ntrivial.\n"},{"id":"20238","messageId":"Pine.LNX.4.64.0605181112040.10823@g5.osdl.org","threadId":"4195","inReplyTo":"E1Fgmkh-0000ur-Hn@moooo.ath.cx","subject":"Re: git status and empty directories","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-05-18T18:12:43Z","receivedAt":"2006-05-18T18:12:43Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 18 May 2006, Matthias Lederhofer wrote:\n>\n> - hide empty directories if the user does not ask explicitly for them\n>   with a command line option\n\nLike this?\n\nMakes sense to me, although I didn't add the option to disable it.\n\n\t\tLinus\n\n---\ndiff --git a/git-commit.sh b/git-commit.sh\nindex 6ef1a9d..ed00b5c 100755\n--- a/git-commit.sh\n+++ b/git-commit.sh\n@@ -136,11 +136,11 @@ #'\n \n \tif test -f \"$GIT_DIR/info/exclude\"\n \tthen\n-\t    git-ls-files -z --others --directory \\\n+\t    git-ls-files -z --others --directory --no-empty-directory \\\n \t\t--exclude-from=\"$GIT_DIR/info/exclude\" \\\n \t\t--exclude-per-directory=.gitignore\n \telse\n-\t    git-ls-files -z --others --directory \\\n+\t    git-ls-files -z --others --directory --no-empty-directory \\\n \t\t--exclude-per-directory=.gitignore\n \tfi |\n \tperl -e '$/ = \"\\0\";\n"},{"id":"20239","messageId":"E1FgnFV-0002FV-39@moooo.ath.cx","threadId":"4195","inReplyTo":"Pine.LNX.4.64.0605181112040.10823@g5.osdl.org","subject":"Re: git status and empty directories","fromName":"Matthias Lederhofer","fromEmail":"matled@gmx.net","sentAt":"2006-05-18T18:29:25Z","receivedAt":"2006-05-18T18:29:25Z","isPatch":false,"sender":{"key":"matled@gmx.net","avatar":null},"body":"> Like this?\nThis is exactly the patch I'm using at the moment and I don't really\nneed an option to unhide empty directories. Maybe someone else\ncomplains for some reason but git clean -d -n shows empty directories\ntoo.\n\nAn option to show untracked files instead of untracked directories\nlike\n> git-ls-files -z --others --exclude-per-directory=.gitignore\nwould be interesting to see what would be added instead of doing ls\nmanually.\n"}]}