fix: resolve local template paths to absolute before storing in answers file - #2717
fix: resolve local template paths to absolute before storing in answers file#2717Oscar-SR wants to merge 6 commits into
Conversation
|
I think this change would break the use case described in #2589. One can always provide an absolute path to |
lhupfeldt
left a comment
There was a problem hiding this comment.
There should be test cases.
Note that I'm not a maintainer.
sisp
left a comment
There was a problem hiding this comment.
Strictly speaking, this is a breaking change because a template path relative to the subproject may break moving the project directory to a different location. But it might be a valuable change to be included in the next major release.
|
Thanks for the feedback! I have refactored the code using |
|
With the current implementation, relative paths including |
|
Re-reading #335 (comment) again, I think converting a local template path that is relative to the current working directory to a path that is relative to the project root is strictly better:
For this to be useful, path traversal (involving There might be a way to make this change non-breaking: I think we could look up a local template according to the new relative path (relative to the project root) and fall back to looking it up according to the old relative path (relative to the current working directory). In both cases, the new relative path would be recorded in the updated answers file on WDYT? |
|
Does the existing relative path work? |
|
Do you mean with the changes of this PR or with the state of With my suggestion, the template path in |
I meant |
|
Hmmm, I think you're right. Currently, |
This fix resolves local template paths to absolute before storing them in the answers file, so they remain valid regardless of the CWD when running
copier update.Remote URLs (gh:, https://, git@) are unaffected since they don't resolve to local paths.
Fixes #335