Skip to content

Commit 8b8c76a

Browse files
author
jcole-crowdstrike
committed
Fixing stripping issue causing passing tests to be interpreted as failures
Removing this block of code that strips away nonprintable ASCII characters, as it is causing some tests to fail inappropriately. Successful tests are identified by the suffix ", done", which is being removed from some messages due to this aforementioned block of code. The codeblock probably intends to just strip away traililng non-ASCII characters from strings, but does not break, and so will instead continue to iterate through the string and then strip away both printable/nonprintable ASCII; this is causing the loss of the ", done" because anytime a nonprintable character is anywhere but the end of the string then the entire section of string after the character is truncated. Looking back through commits, this codeblock was added in 882ebb1 as a workaround after the addition of universal_newlines. Seeing as we have removed universal_newlines in the previous commit, we can also remove this codeblock. In future, if something likw this is needed, then maybe a join that concatenates all printable ASCII characters would serve better (e.g., "".join(b for b in line if b >= 32)), instead of trying to cut out the nonprintable chars.
1 parent 938f272 commit 8b8c76a

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

Diff for: git/util.py

-14
Original file line numberDiff line numberDiff line change
@@ -611,20 +611,6 @@ def _parse_progress_line(self, line: AnyStr) -> None:
611611
self.error_lines.append(self._cur_line)
612612
return
613613

614-
# Find escape characters and cut them away - regex will not work with
615-
# them as they are non-ASCII. As git might expect a tty, it will send them.
616-
last_valid_index = None
617-
for i, c in enumerate(reversed(line_str)):
618-
if ord(c) < 32:
619-
# its a slice index
620-
last_valid_index = -i - 1
621-
# END character was non-ASCII
622-
# END for each character in line
623-
if last_valid_index is not None:
624-
line_str = line_str[:last_valid_index]
625-
# END cut away invalid part
626-
line_str = line_str.rstrip()
627-
628614
cur_count, max_count = None, None
629615
match = self.re_op_relative.match(line_str)
630616
if match is None:

0 commit comments

Comments
 (0)