Skip to content

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

Open
@msclock

Description

@msclock

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageTrying to make sure if this is valid or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions