Updating regex pattern to handle unicode whitespaces. by jcole-crowdstrike · Pull Request #1853 · gitpython-developers/GitPython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions git/remote.py
14 changes: 0 additions & 14 deletions git/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -611,20 +611,6 @@ def _parse_progress_line(self, line: AnyStr) -> None:
self.error_lines.append(self._cur_line)
return

# Find escape characters and cut them away - regex will not work with
# them as they are non-ASCII. As git might expect a tty, it will send them.
last_valid_index = None
for i, c in enumerate(reversed(line_str)):
if ord(c) < 32:
# its a slice index
last_valid_index = -i - 1
# END character was non-ASCII
# END for each character in line
if last_valid_index is not None:
line_str = line_str[:last_valid_index]
# END cut away invalid part
line_str = line_str.rstrip()

cur_count, max_count = None, None
match = self.re_op_relative.match(line_str)
if match is None:
Expand Down
16 changes: 16 additions & 0 deletions test/test_remote.py