chiark / gitweb /
Let "stg status" ignore empty directories
authorKarl Hasselström <kha@treskal.com>
Fri, 31 Aug 2007 19:41:54 +0000 (21:41 +0200)
committerKarl Hasselström <kha@treskal.com>
Fri, 31 Aug 2007 19:41:54 +0000 (21:41 +0200)
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 <kha@treskal.com>
stgit/git.py

index f315b053cacc63fd45ae9b48aabf36f181e4209d..885720918c6a4b9415860e8300d73ae6da993e76 100644 (file)
@@ -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()