◐ Shell
reader mode source ↗
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
File filter
Conversations
Jump to
Diff view
Apply and reload
Show whitespace
Diff view
Apply and reload
8 changes: 4 additions & 4 deletions git/remote.py
Original file line number Diff line number Diff line change
@@ -325,7 +325,7 @@ class FetchInfo(IterableObj):
ERROR,
) = [1 << x for x in range(8)]

_re_fetch_result = re.compile(r"^\s*(.) (\[[\w\s\.$@]+\]|[\w\.$@]+)\s+(.+) -> ([^\s]+)( \(.*\)?$)?")

_flag_map: Dict[flagKeyLiteral, int] = {
"!": ERROR,
Expand Down Expand Up @@ -891,7 +891,7 @@ def _get_fetch_info_from_stderr(
None,
progress_handler,
finalizer=None,
decode_streams=False,
kill_after_timeout=kill_after_timeout,
)

Expand Down Expand Up @@ -1068,7 +1068,7 @@ def fetch(
Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_fetch_options)

proc = self.repo.git.fetch(
"--", self, *args, as_process=True, with_stdout=False, universal_newlines=True, v=verbose, **kwargs
)
res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout)
if hasattr(self.repo.odb, "update_cache"):
Expand Down Expand Up @@ -1122,7 +1122,7 @@ def pull(
Git.check_unsafe_options(options=list(kwargs.keys()), unsafe_options=self.unsafe_git_pull_options)

proc = self.repo.git.pull(
"--", self, refspec, with_stdout=False, as_process=True, universal_newlines=True, v=True, **kwargs
)
res = self._get_fetch_info_from_stderr(proc, progress, kill_after_timeout=kill_after_timeout)
if hasattr(self.repo.odb, "update_cache"):
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,22 @@ def test_push_unsafe_options_allowed(self, rw_repo):
assert tmp_file.exists()
tmp_file.unlink()


class TestTimeouts(TestBase):
@with_rw_repo("HEAD", bare=False)
Expand Down
Toggle all file notes Toggle all file annotations