Bug 1658626 - When listing files from git in mozversioncontrol, ignore empty paths r=froydnj,mhentges

Without this patch, the last "path" in this list will always be the empty string due to how the `-z` option to `git` works. This mirrors what we already do in the `get_files_in_working_directory` implementation for `hg`.

Differential Revision: https://phabricator.services.mozilla.com/D86752
This commit is contained in:
Ricky Stewart
2020-08-12 00:10:43 +00:00
parent 591803e324
commit 2c063cc3d4

View File

@@ -550,7 +550,7 @@ class GitRepository(Repository):
self._run('reset', *paths)
def get_files_in_working_directory(self):
return self._run('ls-files', '-z').split('\0')
return [p for p in self._run('ls-files', '-z').split('\0') if p]
def working_directory_clean(self, untracked=False, ignored=False):
args = ['status', '--porcelain']