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

Answers file templating fails when copy message is provided #1825

Closed
MigQ2 opened this issue Oct 20, 2024 · 2 comments · Fixed by #1840
Closed

Answers file templating fails when copy message is provided #1825

MigQ2 opened this issue Oct 20, 2024 · 2 comments · Fixed by #1840
Labels
bug triage Trying to make sure if this is valid or not

Comments

@MigQ2
Copy link

MigQ2 commented Oct 20, 2024

Describe the problem

The answers file templating fails when using a _message_before_copy and _message_after_copy

If the messages are removed the answers file gets correctly templated

I don't know how the copier internals work well enough to figure out why this is happening. Any ideas?

Template

I created a dummy template in https://github.com/MigQ2/dummy-copier-template, with the master branch working fine but the fix/broken-template branch doesn't work.

The only difference between both branches is the _message_before_copy and _message_after_copy, you can check that here

To Reproduce

I am using copier==9.4.1

You can run copier copy -d dummy_answer="myanswer" https://github.com/MigQ2/dummy-copier-template.git . and see that the copier answers file gets correctly templated:

image

Then run copier copy --vcs-ref fix/broken-template -d dummy_answer="myanswer" https://github.com/MigQ2/dummy-copier-template.git . and you will see the copier answers file doesn't resolve the template:

image

Logs

No response

Expected behavior

Answer file should be correctly templated when using a message

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Ubuntu 22.04.3 LTS (running on WSL)

Copier version

9.4.1

Python version

3.10

Installation method

pip+pypi

Additional context

No response

@MigQ2 MigQ2 added bug triage Trying to make sure if this is valid or not labels Oct 20, 2024
@sisp
Copy link
Member

sisp commented Oct 29, 2024

Thanks for reporting this bug, @MigQ2! 🙏 I've been able to reproduce the bug (also on the current tip of the master branch) and submitted a PR that fixes it: #1840

@cbrown1234
Copy link

I had been running into this issue, and couldn't work out what was causing it for ages until I finally realised it was _message_before_copy. As I was looking into it to try to fix it, I came across your test, thanks for fixing @sisp!

Could I ask what's the release cadence? I'm interested when this (and another PR I've submitted #1892) could be available for users of our templates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Trying to make sure if this is valid or not
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants