commit 65220bb2cef165004d1cafb6eff8c89aff6c7749 from: Stefan Sperling date: Tue Jun 25 08:54:01 2024 UTC emulate Git's behaviour when a server does not support object filtering Git prints a warning and proceeds with an unfiltered clone/fetch operation. Make dulwich behave the same way, for now. commit - 2647c582be7258251ad5c0e7442c48023939930f commit + 65220bb2cef165004d1cafb6eff8c89aff6c7749 blob - d29341f13ea650841c8f93db9a5ba2e3262bb2ba blob + bdf5217581836e69e003da3dbfe2a69d7b701ec3 --- dulwich/client.py +++ dulwich/client.py @@ -1111,7 +1111,16 @@ class GitClient: """Retrieve an archive of the specified tree.""" raise NotImplementedError(self.archive) + @staticmethod + def _warn_filter_objects(): + import warnings + warnings.warn( + "object filtering not recognized by server, ignoring", + UserWarning, + ) + + def check_wants(wants, refs): """Check that a set of wants is valid. @@ -1365,6 +1374,10 @@ class TraditionalGitClient(GitClient): and filter_spec ): proto.write(pkt_line(b"filter %s\n" % filter_spec)) + elif filter_spec: + self._warn_filter_objects() + elif filter_spec: + self._warn_filter_objects() (new_shallow, new_unshallow) = _handle_upload_pack_head( proto, negotiated_capabilities, @@ -2568,8 +2581,12 @@ class AbstractHttpGitClient(GitClient): and filter_spec ): data += pkt_line(b"filter %s\n" % filter_spec) + elif filter_spec: + self._warn_filter_objects() data += req_data.getvalue() else: + if filter_spec: + self._warn_filter_objects() data = req_data.getvalue() resp, read = self._smart_request("git-upload-pack", url, data) try: