diff options
author | nfnty <git@nfnty.se> | 2016-02-07 23:41:15 +0100 |
---|---|---|
committer | nfnty <git@nfnty.se> | 2016-02-08 04:43:05 +0100 |
commit | af8c2f6a1942011146b62f24c1cc42570a80cd97 (patch) | |
tree | 2a9dc08245a64271be149432fda24047d2fbbb67 /ranger | |
parent | 2753e22e6ba3a17482709747be2de2eb6a6a719c (diff) | |
download | ranger-af8c2f6a1942011146b62f24c1cc42570a80cd97.tar.gz |
VCS: Improve null handling
Diffstat (limited to 'ranger')
-rw-r--r-- | ranger/ext/vcs/bzr.py | 2 | ||||
-rw-r--r-- | ranger/ext/vcs/git.py | 9 |
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 |