Created
June 20, 2015 06:55
-
-
Save ohumbel/1271a026a7c016ae4156 to your computer and use it in GitHub Desktop.
python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def splitoutputofgitstatusz(self, line): | |
""" | |
:param line: the output line from the command 'git status -z' | |
:return: a list of all repository files with status changes | |
""" | |
repositoryfiles = [] | |
entries = line.split(sep='\x00') # ascii 0 is the delimiter | |
for entry in entries: | |
entry = entry.strip() | |
if len(entry) > 0: | |
start = entry.find(' ') | |
if 1 <= start <= 2: | |
repositoryfile = entry[3:] # output is formatted | |
else: | |
repositoryfile = entry # file on a single line (e.g. rename continuation) | |
repositoryfiles.append(repositoryfile) | |
return repositoryfiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment