Skip to content

Commit

Permalink
vcs: use peeled ref when retrieving tag revision (#9849)
Browse files Browse the repository at this point in the history
This is required to support incoming changes introduced in dulwich
>=0.22.2. This change preserves current behaviour and ensures locks
do not change when dulwich is updated.
  • Loading branch information
abn authored Nov 17, 2024
1 parent 0ebfd63 commit aa73b3a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/poetry/vcs/git/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def get_remote_url(repo: Repo, remote: str = "origin") -> str:
@staticmethod
def get_revision(repo: Repo) -> str:
with repo:
return repo.head().decode("utf-8")
return repo.get_peeled(b"HEAD").decode("utf-8")

@classmethod
def info(cls, repo: Repo | Path) -> GitRepoLocalInfo:
Expand Down Expand Up @@ -434,7 +434,8 @@ def clone(
current_repo = Repo(str(target))

with current_repo:
current_sha = current_repo.head().decode("utf-8")
# we use peeled sha here to ensure tags are resolved consistently
current_sha = current_repo.get_peeled(b"HEAD").decode("utf-8")
except (NotGitRepository, AssertionError, KeyError):
# something is wrong with the current checkout, clean it
remove_directory(target, force=True)
Expand Down

0 comments on commit aa73b3a

Please sign in to comment.