summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/ext/vcs/bzr.py2
-rw-r--r--ranger/ext/vcs/git.py9
2 files changed, 6 insertions, 5 deletions
diff --git a/ranger/ext/vcs/bzr.py b/ranger/ext/vcs/bzr.py
index 11461f97..f39ac00f 100644
--- a/ranger/ext/vcs/bzr.py
+++ b/ranger/ext/vcs/bzr.py
@@ -103,7 +103,7 @@ class Bzr(Vcs):
         statuses = {}
 
         # Ignored
-        for path in self._bzr(['ls', '--null', '--ignored']).split('\x00')[:-1]:
+        for path in self._bzr(['ls', '--null', '--ignored']).rstrip('\x00').split('\x00'):
             statuses[path] = 'ignored'
 
         # Paths with status
diff --git a/ranger/ext/vcs/git.py b/ranger/ext/vcs/git.py
index e64055a1..e50ed3de 100644
--- a/ranger/ext/vcs/git.py
+++ b/ranger/ext/vcs/git.py
@@ -102,7 +102,7 @@ class Git(Vcs):
 
         # Paths with status
         skip = False
-        for line in self._git(['status', '--porcelain', '-z']).split('\x00')[:-1]:
+        for line in self._git(['status', '--porcelain', '-z']).rstrip('\x00').split('\x00'):
             if skip:
                 skip = False
                 continue
@@ -121,19 +121,20 @@ class Git(Vcs):
         # Ignored directories
         for path in self._git(
                 ['ls-files', '-z', '--others', '--directory', '--ignored', '--exclude-standard'])\
-                .split('\x00')[:-1]:
+                .rstrip('\x00').split('\x00'):
             if path.endswith('/'):
                 statuses[os.path.normpath(path)] = 'ignored'
 
         # Empty directories
         for path in self._git(['ls-files', '-z', '--others', '--directory', '--exclude-standard'])\
-                .split('\x00')[:-1]:
+                .rstrip('\x00').split('\x00'):
             if path.endswith('/'):
                 statuses[os.path.normpath(path)] = 'none'
 
         # Paths with status
         skip = False
-        for line in self._git(['status', '--porcelain', '-z', '--ignored']).split('\x00')[:-1]:
+        for line in self._git(['status', '--porcelain', '-z', '--ignored'])\
+                .rstrip('\x00').split('\x00'):
             if skip:
                 skip = False
                 continue