Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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