Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions gitfourchette/gitdriver/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,19 @@ def parseGitStatus(stdout: str, workdir: str):

while pos < limit:
ident = stdout[pos]
try:
pattern = _gitStatusPatterns[ident]
except KeyError:
logging.warning(f"unknown git status ident '{ident}'")
pattern = _gitStatusPatterns.get(ident)
match = pattern.match(stdout, pos) if pattern is not None else None

if match is None:
# Unknown ident or malformed record. Skip to the next NUL-terminated
# entry rather than re-reading the same character forever.
logging.warning(f"skipping unparseable git status entry (ident '{ident}')")
nul = stdout.find("\x00", pos)
if nul < 0:
break
pos = nul + 1
continue

match = pattern.match(stdout, pos)
pos = match.end()

staged, unstaged = _parseStatusLine(ident, *match.groups())
Expand Down