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

copier update -a in the subdirectory dosen't respect _skip_if_exists in copier config yml #1894

Open
msclock opened this issue Dec 17, 2024 · 2 comments · May be fixed by #1896
Open

copier update -a in the subdirectory dosen't respect _skip_if_exists in copier config yml #1894

msclock opened this issue Dec 17, 2024 · 2 comments · May be fixed by #1896
Labels
bug triage Trying to make sure if this is valid or not

Comments

@msclock
Copy link

msclock commented Dec 17, 2024

Describe the problem

With copier copy commands, it can read _skip_if_exists in copier config yml to skip some files by template owner's intentions.
But with copier update commands, it only see a answered file and doesn't know the files to be needed to skip. It needs to use -s to skip files manually.

Template

Use renovate copier manager can update template https://github.com/serious-scaffold/ss-cmake in the my repo sub folder https://github.com/serious-scaffold/ss-pybind11/tree/master/template automatically. And it seems not possible to specify files to skip in the renovaterc.json. Also, it is not reasonable to specify files for general use. See serious-scaffold/ss-pybind11#73, it still reported conflicts requiring manual resolution and didn't update without conflicts according to _skip_if_exists in copier config file https://github.com/serious-scaffold/ss-cmake/blob/ab17e79610f249422663c0f3c70d5d4a70a0ea15/copier.yml#L18-L23

To Reproduce

Reproduce results in pr:

git clone https://github.com/serious-scaffold/ss-pybind11
git checkout a0a8bb49a4653f0da086f6ebbe7b41f7e223b83b
cd template 
copier update -a .copier-answers.ss-cmake.yml

Logs

vscode ➜ /workspaces/ss-pybind11/template (a0a8bb4) $ copier update -a .copier-answers.ss-cmake.yml
Updating to template version 0.0.7
vscode ➜ /workspaces/ss-pybind11/template (a0a8bb4) $ git status
HEAD detached at a0a8bb4
Unmerged paths:
  (use "git restore --staged <file>..." to unstage)
  (use "git add <file>..." to mark resolution)
        both modified:   CMakeLists.txt.jinja
        both modified:   vcpkg.json.jinja

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   .copier-answers.ss-cmake.yml

no changes added to commit (use "git add" and/or "git commit -a")
vscode ➜ /workspaces/ss-pybind11/template (a0a8bb4) $ cat CMakeLists.txt.jinja | grep updating
<<<<<<< before updating
>>>>>>> after updating

It update successfully with conflicts results.

Expected behavior

It can update template according to _skip_if_exists files in copier config yml or specify files to skip in a answered file.(Prefer to the second solution)

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Linux f3e2c9372be8 5.15.133.1-microsoft-standard-WSL2 #1 SMP Thu Oct 5 21:02:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Copier version

copier 9.4.1

Python version

Python 3.10.12

Installation method

pipx+pypi

Additional context

No response

@msclock msclock added bug triage Trying to make sure if this is valid or not labels Dec 17, 2024
@msclock
Copy link
Author

msclock commented Dec 18, 2024

Is it possible to specify files to skip in the answered file? I consider it is more general use.

@msclock msclock changed the title copier update -a dosen't respect _skip_if_exists in copier config yml copier update -a in the subdirectory dosen't respect _skip_if_exists in copier config yml Dec 23, 2024
@msclock
Copy link
Author

msclock commented Dec 24, 2024

Is it possible to specify files to skip in the answered file? I consider it is more general use.

I consider .tmpl is the solution from #1892

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.

1 participant