Skip to content

fix: fallback to HEAD when remote tag lookup fails#2564

Closed
saschabuehrle wants to merge 1 commit into
copier-org:masterfrom
saschabuehrle:fix/issue-2559
Closed

fix: fallback to HEAD when remote tag lookup fails#2564
saschabuehrle wants to merge 1 commit into
copier-org:masterfrom
saschabuehrle:fix/issue-2559

Conversation

@saschabuehrle
Copy link
Copy Markdown

Bug

#2559 — when git ls-remote --tags --refs fails for a credentialed private template URL, Copier raises immediately while resolving the latest tag, instead of continuing with a valid fallback path.

Fix

get_latest_tag() now catches ProcessExecutionError from git ls-remote and gracefully falls back to HEAD. This preserves copy behavior for templates that are still cloneable with embedded credentials even when remote tag listing is denied.

I also added a focused regression test to ensure get_latest_tag() returns HEAD on ls-remote failures.

Testing

  • python3 -m py_compile copier/_vcs.py tests/test_vcs.py
  • python3 -m pytest ... could not be executed here because pytest is not installed in this environment.

Happy to address any feedback.

Greetings, saschabuehrle

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Mar 20, 2026

In #2559 both @sisp and @valentinoli confirmed the git ls-remote command worked fine, so I'm not sure to understand why this PR tries to fix get_latest_tag.

The PR body makes me think it was AI-generated, esp.

python3 -m pytest ... could not be executed here because pytest is not installed in this environment.

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Mar 20, 2026

Looking at their profile, they seem to open a lot of PRs in many various repositories, all looking the same, some of them closed because no issue was created before sending the PR or because the PR template was overridden. So, AI slop to me. I'll let you decide what to do @sisp (blocking the user, or something else).

@sisp
Copy link
Copy Markdown
Member

sisp commented Mar 20, 2026

Thanks for the quick sanity check review and researching user activity to get more context, @pawamoy. I'd wait for a reply by @saschabuehrle and give the opportunity to update the PR; blocking should be a last resort to protect against spam. Let's see. 🙂

@pawamoy
Copy link
Copy Markdown
Contributor

pawamoy commented Mar 20, 2026

@saschabuehrle
Copy link
Copy Markdown
Author

Fair points — re-examining the issue, the root cause isn't in get_latest_tag. Closing this. Sorry for the noise.

Greetings, saschabuehrle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants