fix: fallback to HEAD when remote tag lookup fails#2564
Conversation
|
In #2559 both @sisp and @valentinoli confirmed the The PR body makes me think it was AI-generated, esp.
|
|
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). |
|
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. 🙂 |
|
Unfortunately the replies by @saschabuehrle also seem to be AI-generated. |
|
Fair points — re-examining the issue, the root cause isn't in get_latest_tag. Closing this. Sorry for the noise. Greetings, saschabuehrle |
Bug
#2559 — when
git ls-remote --tags --refsfails 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 catchesProcessExecutionErrorfromgit ls-remoteand gracefully falls back toHEAD. 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()returnsHEADonls-remotefailures.Testing
python3 -m py_compile copier/_vcs.py tests/test_vcs.pypython3 -m pytest ...could not be executed here becausepytestis not installed in this environment.Happy to address any feedback.
Greetings, saschabuehrle