You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running copier recopy --force doesn't delete files or directories that were removed from the source.
Template
$ mkdir -p copier-template/work/work/{new,old}-dir/
$ touch copier-template/work/work/{new,old}-dir/file.txt
$ cat <<EOF > copier-template/work/{{_copier_conf.answers_file}}.jinja{{ _copier_answers|to_nice_yaml -}}EOF
$ cat <<EOF > copier-template/copier.yml_subdirectory: "{{ sub }}"_min_copier_version: "9.2.0"sub: type: str help: What kind of subdirectory do you want to create? choices: - workEOF
To Reproduce
$ mkdir copier-target
$ cd copier-target
$ copier copy -d 'sub=work' ../copier-template/ .Copying from template version None create .copier-answers.yml create work create work/old-dir create work/old-dir/file.txt create work/new-dir create work/new-dir/file.txt
$ rm -rf ../copier-template/work/work/old-dir/
$ copier recopy --forceCopying from template version None identical .copier-answers.yml identical work identical work/new-dir identical work/new-dir/file.txt
$ tree -a.├── .copier-answers.yml└── work ├── new-dir │ └── file.txt └── old-dir └── file.txt
$ tree ../copier-template/../copier-template/├── copier.yml└── work ├── work │ └── new-dir │ └── file.txt └── {{_copier_conf.answers_file}}.jinja
Logs
No response
Expected behavior
I would expect recopy to remove what was once managed by Copier and anything that wasn't managed by Copier to be left alone. If a new file/directory gets added to the target then running recopy shouldn't remove it, but if a file/directory was in the source and no longer is, then it should be removed.
Screenshots/screencasts/logs
No response
Operating system
macOS
Operating system distribution and version
Sequoia 15.1
Copier version
9.4.1
Python version
3.13.0
Installation method
pipx+pypi
Additional context
The reproduction case is done with local templates, but the same issue is present for Git-based templates. The reproduction showed how the removed directory isn't detected, but the same applies for files. The reproduction doesn't require the top-level directories to be named identically (i.e. work/work) and is just accidental, they could be renamed as one wants.
I'm assuming all of this isn't intentional, but if it is then I'd be curious to know of any workarounds to this.
The text was updated successfully, but these errors were encountered:
Describe the problem
Running
copier recopy --force
doesn't delete files or directories that were removed from the source.Template
To Reproduce
Logs
No response
Expected behavior
I would expect
recopy
to remove what was once managed by Copier and anything that wasn't managed by Copier to be left alone. If a new file/directory gets added to the target then runningrecopy
shouldn't remove it, but if a file/directory was in the source and no longer is, then it should be removed.Screenshots/screencasts/logs
No response
Operating system
macOS
Operating system distribution and version
Sequoia 15.1
Copier version
9.4.1
Python version
3.13.0
Installation method
pipx+pypi
Additional context
The reproduction case is done with local templates, but the same issue is present for Git-based templates. The reproduction showed how the removed directory isn't detected, but the same applies for files. The reproduction doesn't require the top-level directories to be named identically (i.e.
work/work
) and is just accidental, they could be renamed as one wants.I'm assuming all of this isn't intentional, but if it is then I'd be curious to know of any workarounds to this.
The text was updated successfully, but these errors were encountered: