From 1bb465122f9673c9834b094c49d815148e84b8eb Mon Sep 17 00:00:00 2001 From: Florent Valette Date: Mon, 14 Oct 2024 21:39:37 +0200 Subject: [PATCH 1/3] git,remote: use universal new lines for fetch/pull stderr capture See https://github.com/gitpython-developers/GitPython/issues/1969 stderr parser call RemoteProgress update on each line received. With universal_newlines set to False, there is a mixup between line feed and carriage return. In the `handle_process_output` thread, this is thus seen as a single line for the whole output on each steps. --- git/remote.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/git/remote.py b/git/remote.py index 9de3dace4..20e42b412 100644 --- a/git/remote.py +++ b/git/remote.py @@ -894,7 +894,7 @@ def _get_fetch_info_from_stderr( None, progress_handler, finalizer=None, - decode_streams=True, + decode_streams=False, kill_after_timeout=kill_after_timeout, ) @@ -1071,7 +1071,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=False, v=verbose, **kwargs + "--", 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"): @@ -1125,7 +1125,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=False, v=True, **kwargs + "--", 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"): From 52cceaf2663422a79a0f1d21f905eb132e46b556 Mon Sep 17 00:00:00 2001 From: Florent Valette Date: Tue, 15 Oct 2024 18:04:44 +0200 Subject: [PATCH 2/3] git,cmd: add encoding arg to popen if universal newlines is True --- git/cmd.py | 1 + 1 file changed, 1 insertion(+) diff --git a/git/cmd.py b/git/cmd.py index 90fc39cd6..2048a43fa 100644 --- a/git/cmd.py +++ b/git/cmd.py @@ -1269,6 +1269,7 @@ def execute( stdout=stdout_sink, shell=shell, universal_newlines=universal_newlines, + encoding=defenc if universal_newlines else None, **subprocess_kwargs, ) except cmd_not_found_exception as err: From d6cdb67bcaa2cf606bfc0a9295aacb54677ea86d Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Tue, 15 Oct 2024 20:35:29 +0200 Subject: [PATCH 3/3] See if python 3.7 still works when using an older Ubuntu version. This should be undone once python 3.7 is EOL. --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 292c9fc86..747db62f0 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-latest", "macos-latest", "windows-latest"] + os: ["ubuntu-22.04", "macos-latest", "windows-latest"] python-version: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] exclude: - os: "macos-latest"