Skip to content

Commit 16173e7

Browse files
fix treating LsRemoteResult as a dictionary is deprecated (#449)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent e142017 commit 16173e7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/scmrepo/git/backend/dulwich/__init__.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -601,14 +601,13 @@ def iter_remote_refs(self, url: str, base: Optional[str] = None, **kwargs):
601601
raise InvalidRemote(url) from exc
602602

603603
try:
604+
refs = client.get_refs(path.encode()).refs
605+
604606
if base:
605-
yield from (
606-
os.fsdecode(ref)
607-
for ref in client.get_refs(path.encode())
608-
if ref.startswith(os.fsencode(base))
609-
)
607+
base_b = os.fsencode(base)
608+
yield from (os.fsdecode(ref) for ref in refs if ref.startswith(base_b))
610609
else:
611-
yield from (os.fsdecode(ref) for ref in client.get_refs(path.encode()))
610+
yield from (os.fsdecode(ref) for ref in refs)
612611
except NotGitRepository as exc:
613612
raise InvalidRemote(url) from exc
614613
except HTTPUnauthorized as exc:

0 commit comments

Comments
 (0)