Bug 1334556 - make GitRepository.get_modified_files slightly more idiomatic; r=gps

Having to munge the output of `git status --porcelain` is unseemly when
there are approaches that will give us what we want directly.
This commit is contained in:
Nathan Froyd 2017-01-27 13:51:58 -05:00
Родитель 3317135d5c
Коммит deb4dfaf07
1 изменённых файлов: 1 добавлений и 2 удалений

Просмотреть файл

@ -87,8 +87,7 @@ class GitRepository(Repository):
super(GitRepository, self).__init__(path, 'git')
def get_modified_files(self):
# This is a little wonky, but it's good enough for this purpose.
return [bits[1] for bits in map(lambda line: line.strip().split(), self._run('status', '--porcelain').splitlines()) if 'M' in bits[0]]
return self._run('diff', '--diff-filter=M', '--name-only').splitlines()
def add_remove_files(self, path):
self._run('add', path)