Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vcs: use peeled ref when retrieving tag revision #9849

Merged
merged 1 commit into from
Nov 17, 2024
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")
abn marked this conversation as resolved.
Show resolved Hide resolved

@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
Loading