git_repo source with no track set crashes plugin if dulwich raises not our ref
The not our ref likely happens due to gitlab.gnome.org's http redirection or some bot protection but it should never crash. ```yaml sources: - kind: git_repo url: gnome:libglnx.git ref: ccea836b799256420788c463a638ded0636b1632 directory: subprojects/libglnx ``` ``` An unhandled exception occured: Traceback (most recent call last): File "/home/bbhtt/Git/gitlab/freedesktop-sdk/buildstream-plugins-community/src/buildstream_plugins_community/sources/_git_utils.py", line 289, in fetch remote_refs = client.fetch( path, ...<2 lines>... depth=self.depth, ) File "/usr/lib/python3.14/site-packages/dulwich/client.py", line 1171, in fetch result = self.fetch_pack( path, ...<9 lines>... shallow_exclude=shallow_exclude, ) File "/usr/lib/python3.14/site-packages/dulwich/client.py", line 3910, in fetch_pack (new_shallow, new_unshallow) = _read_shallow_updates( ~~~~~~~~~~~~~~~~~~~~~^ resp_proto.read_pkt_seq() ^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/usr/lib/python3.14/site-packages/dulwich/client.py", line 615, in _read_shallow_updates raise GitProtocolError(f"unknown command {pkt!r}") dulwich.errors.GitProtocolError: unknown command b'ERR upload-pack: not our ref ccea836b799256420788c463a638ded0636b1632' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.14/site-packages/buildstream/_scheduler/jobs/job.py", line 350, in child_action result = self.child_process() # pylint: disable=assignment-from-no-return File "/usr/lib/python3.14/site-packages/buildstream/_scheduler/jobs/elementjob.py", line 81, in child_process return self._action_cb(self._element) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/site-packages/buildstream/_scheduler/queues/fetchqueue.py", line 75, in _fetch_not_original element._fetch(fetch_original=False) ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.14/site-packages/buildstream/element.py", line 2278, in _fetch self.__sources.fetch() ~~~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/site-packages/buildstream/_elementsources.py", line 221, in fetch self.fetch_sources() ~~~~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/site-packages/buildstream/_elementsources.py", line 250, in fetch_sources self._fetch_source(source) ~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/usr/lib/python3.14/site-packages/buildstream/_elementsources.py", line 431, in _fetch_source source._fetch() ~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/site-packages/buildstream/source.py", line 1481, in _fetch self.__do_fetch() ~~~~~~~~~~~~~~~^^ File "/usr/lib/python3.14/site-packages/buildstream/source.py", line 1957, in __do_fetch fetcher.fetch(mirror) ~~~~~~~~~~~~~^^^^^^^^ File "/home/bbhtt/Git/gitlab/freedesktop-sdk/buildstream-plugins-community/src/buildstream_plugins_community/sources/_git_utils.py", line 299, in fetch remote_refs = client.fetch( path, repo, determine_wants=track_want ) File "/usr/lib/python3.14/site-packages/dulwich/client.py", line 1171, in fetch result = self.fetch_pack( path, ...<9 lines>... shallow_exclude=shallow_exclude, ) File "/usr/lib/python3.14/site-packages/dulwich/client.py", line 3832, in fetch_pack wants = determine_wants(refs_filtered) File "/home/bbhtt/Git/gitlab/freedesktop-sdk/buildstream-plugins-community/src/buildstream_plugins_community/sources/_git_utils.py", line 271, in track_want wanted_refs = get_matching_refs( refs, self.source.tracking, self.source.exclude ) File "/home/bbhtt/Git/gitlab/freedesktop-sdk/buildstream-plugins-community/src/buildstream_plugins_community/sources/_git_utils.py", line 488, in get_matching_refs matching_regex = pattern_to_regex(tracking) File "/home/bbhtt/Git/gitlab/freedesktop-sdk/buildstream-plugins-community/src/buildstream_plugins_community/sources/_git_utils.py", line 478, in pattern_to_regex if pattern.startswith("refs/"): ^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'startswith' ```
issue