From 6d0d7ee68bda85bd5b943d6836a5001cd887c939 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karl=20Hasselstr=C3=B6m?= Date: Fri, 31 Aug 2007 21:41:54 +0200 Subject: [PATCH] Let "stg status" ignore empty directories MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This was a really simple fix: just pass the right flag to git-ls-files. Since the output has a trailing \0, split() gives us an empty string at the end of the list that we have to throw away. (Curiously, there was an empty string at the end before this change too, but it disappeared somehow.) This fixes bug 9891. Signed-off-by: Karl Hasselström --- stgit/git.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stgit/git.py b/stgit/git.py index f315b053..88572091 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -181,7 +181,8 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False, # unknown files if unknown: - cmd = ['git-ls-files', '-z', '--others', '--directory'] + cmd = ['git-ls-files', '-z', '--others', '--directory', + '--no-empty-directory'] if not noexclude: cmd += ['--exclude=%s' % s for s in ['*.[ao]', '*.pyc', '.*', '*~', '#*', 'TAGS', 'tags']] @@ -191,7 +192,7 @@ def tree_status(files = None, tree_id = 'HEAD', unknown = False, if os.path.exists(fn)] lines = GRun(*cmd).raw_output().split('\0') - cache_files += [('?', line) for line in lines] + cache_files += [('?', line) for line in lines if line] # conflicted files conflicts = get_conflicts() -- 2.11.4.GIT