Skip to content

Commit aa73b3a

Browse files
authored
vcs: use peeled ref when retrieving tag revision (#9849)
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.
1 parent 0ebfd63 commit aa73b3a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/poetry/vcs/git/backend.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def get_remote_url(repo: Repo, remote: str = "origin") -> str:
176176
@staticmethod
177177
def get_revision(repo: Repo) -> str:
178178
with repo:
179-
return repo.head().decode("utf-8")
179+
return repo.get_peeled(b"HEAD").decode("utf-8")
180180

181181
@classmethod
182182
def info(cls, repo: Repo | Path) -> GitRepoLocalInfo:
@@ -434,7 +434,8 @@ def clone(
434434
current_repo = Repo(str(target))
435435

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

0 commit comments

Comments
 (0)