copier icon indicating copy to clipboard operation
copier copied to clipboard

Copier update creates .rej files even when I'm passing --conflict inline

Open pauloneves opened this issue 3 months ago • 1 comments

Describe the problem

First of all, thanks for the delightful project. I was a cookie cutter heavy user, and can say that this project is miles away.

Now the bug 😊

I'm using copier 10.3 with some custom extension.

Although I'm trying to force --conflicts=inline, copier is still creating .rej files

Here is my command line

    uv run copier update --trust \
      --skip-answered \
      --defaults \
      --skip-tasks \
      --conflict inline --context-lines=3 

Template

sorry, it's my company code and I can't share. I have some tasks like this:

_tasks:
  - command: >
      uv run --project "{{ _copier_conf.src_path }}/copier" --no-dev "{{ _copier_conf.src_path }}/copier/post_devops.py" .copier-answers.yml devops-params.toml
    when: "{{ _copier_operation == 'copy' }}"

_migrations:
  - command: >
      uv run --project "{{ _copier_conf.src_path }}/copier" --no-dev "{{ _copier_conf.src_path }}/copier/post_update_template.py" .copier-answers.yml  devops-params.toml
    when: "{{ exec_post_update and (_stage == 'after') }}"

the scripts are inside a copier subdirectory that is excluded

To Reproduce

cd into the copier directory run the command

    uv run copier update --trust \
      --skip-answered \
      --defaults \
      --skip-tasks \
      --conflict inline --context-lines=3 

see *.rej files inside the dir

Logs


Expected behavior

I'd like inline conflicts that are good to solve a 3 way merge editor, like the one in vscode

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Red Hat Enterprise Linux release 9.3 (Plow)

Copier version

copier 9.10.3

Python version

3.11

Installation method

uvx+git

Additional context

No response

pauloneves avatar Nov 07 '25 23:11 pauloneves

Thanks for your warm words about Copier! :bow:

I'm afraid I can't reproduce the problem you're describing without more details, ideally with a minimal reproducible example. --conflict=inline as been the default setting since v8.0.0 ~2.5 years ago, and I haven't observed Copier creating any .rej files when updating a project. I can't imagine how the task or migration you're showing might lead to this behavior (unless they create .rej files themselves), as the value of the _copier_operation variable is "update" while updating, so the task doesn't run because of when: "{{ _copier_operation == 'copy' }}", and the migration task runs after Copier's internal Git-powered update logic because of when: "{{ ... and (_stage == 'after') }}", so any .rej files would be created before it runs.

Could you also double-check your Copier version, please?

sisp avatar Nov 08 '25 19:11 sisp