{"thread":{"id":"9730","subject":"[StGit PATCH] Let \"stg status\" ignore empty directories","startedAt":"2007-08-31T19:43:57Z","lastAt":"2007-08-31T19:43:57Z","messageCount":1,"participants":["Karl Hasselström"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52071","messageId":"20070831194348.18082.49366.stgit@yoghurt","threadId":"9730","inReplyTo":null,"subject":"[StGit PATCH] Let \"stg status\" ignore empty directories","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2007-08-31T19:43:57Z","receivedAt":"2007-08-31T19:43:57Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"This was a really simple fix: just pass the right flag to\ngit-ls-files. Since the output has a trailing \\0, split() gives us an\nempty string at the end of the list that we have to throw away.\n(Curiously, there was an empty string at the end before this change\ntoo, but it disappeared somehow.)\n\nThis fixes bug 9891.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n\n---\n\n stgit/git.py |    5 +++--\n 1 files changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/stgit/git.py b/stgit/git.py\nindex f315b05..8857209 100644\n--- a/stgit/git.py\n+++ b/stgit/git.py\n@@ -181,7 +181,8 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n \n     # unknown files\n     if unknown:\n-        cmd = ['git-ls-files', '-z', '--others', '--directory']\n+        cmd = ['git-ls-files', '-z', '--others', '--directory',\n+               '--no-empty-directory']\n         if not noexclude:\n             cmd += ['--exclude=%s' % s for s in\n                     ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']]\n@@ -191,7 +192,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False,\n                     if os.path.exists(fn)]\n \n         lines = GRun(*cmd).raw_output().split('\\0')\n-        cache_files += [('?', line) for line in lines]\n+        cache_files += [('?', line) for line in lines if line]\n \n     # conflicted files\n     conflicts = get_conflicts()\n"}]}