| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -325,7 +325,7 @@ class FetchInfo(IterableObj): | |||
| 325 | 325 | ERROR, | |
| 326 | 326 | ) = [1 << x for x in range(8)] | |
| 327 | 327 | ||
| 328 | - _re_fetch_result = re.compile(r"^\s*(.) (\[[\w\s\.$@]+\]|[\w\.$@]+)\s+(.+) -> ([^\s]+)( \(.*\)?$)?") | ||
| 328 | + _re_fetch_result = re.compile(r"^ *(.) (\[[\w \.$@]+\]|[\w\.$@]+) +(.+) -> ([^ ]+)( \(.*\)?$)?") | ||
| 329 | 329 | ||
| 330 | 330 | _flag_map: Dict[flagKeyLiteral, int] = { | |
| 331 | 331 | "!": ERROR, | |
@@ -895,7 +895,7 @@ def _get_fetch_info_from_stderr( | |||
| 895 | 895 | None, | |
| 896 | 896 | progress_handler, | |
| 897 | 897 | finalizer=None, | |
| 898 | - decode_streams=False, | ||
| 898 | + decode_streams=True, | ||
| 899 | 899 | kill_after_timeout=kill_after_timeout, | |
| 900 | 900 | ) | |
| 901 | 901 | ||
@@ -1072,7 +1072,7 @@ def fetch( | |||
| 1072 | 1072 | Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_fetch_options) | |
| 1073 | 1073 | ||
| 1074 | 1074 | proc = self.repo.git.fetch( | |
| 1075 | - "--", self, *args, as_process=True, with_stdout=False, universal_newlines=True, v=verbose, **kwargs | ||
| 1075 | + "--", self, *args, as_process=True, with_stdout=False, universal_newlines=False, v=verbose, **kwargs | ||
| 1076 | 1076 | ) | |
| 1077 | 1077 | res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout) | |
| 1078 | 1078 | if hasattr(self.repo.odb, "update_cache"): | |
@@ -1126,7 +1126,7 @@ def pull( | |||
| 1126 | 1126 | Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_pull_options) | |
| 1127 | 1127 | ||
| 1128 | 1128 | proc = self.repo.git.pull( | |
| 1129 | - "--", self, refspec, with_stdout=False, as_process=True, universal_newlines=True, v=True, **kwargs | ||
| 1129 | + "--", self, refspec, with_stdout=False, as_process=True, universal_newlines=False, v=True, **kwargs | ||
| 1130 | 1130 | ) | |
| 1131 | 1131 | res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout) | |
| 1132 | 1132 | if hasattr(self.repo.odb, "update_cache"): | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -611,20 +611,6 @@ def _parse_progress_line(self, line: AnyStr) -> None: | |||
| 611 | 611 | self.error_lines.append(self._cur_line) | |
| 612 | 612 | return | |
| 613 | 613 | ||
| 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 | - | ||
| 628 | 614 | cur_count, max_count = None, None | |
| 629 | 615 | match = self.re_op_relative.match(line_str) | |
| 630 | 616 | if match is None: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1002,6 +1002,22 @@ def test_push_unsafe_options_allowed(self, rw_repo): | |||
| 1002 | 1002 | assert tmp_file.exists() | |
| 1003 | 1003 | tmp_file.unlink() | |
| 1004 | 1004 | ||
| 1005 | + @with_rw_and_rw_remote_repo("0.1.6") | ||
| 1006 | + def test_fetch_unsafe_branch_name(self, rw_repo, remote_repo): | ||
| 1007 | + # Create branch with a name containing a NBSP | ||
| 1008 | + bad_branch_name = f"branch_with_{chr(160)}_nbsp" | ||
| 1009 | + Head.create(remote_repo, bad_branch_name) | ||
| 1010 | + | ||
| 1011 | + # Fetch and get branches | ||
| 1012 | + remote = rw_repo.remote("origin") | ||
| 1013 | + branches = remote.fetch() | ||
| 1014 | + | ||
| 1015 | + # Test for truncated branch name in branches | ||
| 1016 | + assert f"origin/{bad_branch_name}" in [b.name for b in branches] | ||
| 1017 | + | ||
| 1018 | + # Cleanup branch | ||
| 1019 | + Head.delete(remote_repo, bad_branch_name) | ||
| 1020 | + | ||
| 1005 | 1021 | ||
| 1006 | 1022 | class TestTimeouts(TestBase): | |
| 1007 | 1023 | @with_rw_repo("HEAD", bare=False) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments