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

gitignored files removed after update #1162

Closed
hparfr opened this issue May 24, 2023 · 1 comment · Fixed by #1373
Closed

gitignored files removed after update #1162

hparfr opened this issue May 24, 2023 · 1 comment · Fixed by #1373
Labels
Milestone

Comments

@hparfr
Copy link
Contributor

hparfr commented May 24, 2023

Describe the problem

When a file from the template is in gitignore, this file is created with copier copy but then removed by copier update

I don't expect this file to be removed after an update.

Template

.env
copier.yml
{{ _copier_conf.answers_file }}.jinja

To Reproduce

$ git init && echo ".env" >> .gitignore && git add .gitignore && git commit -m "first"
$ copier copy file:///pathtothetemplate/.git .
Copying from template version 0.0.0.post10.dev0+a4f9293
 identical  .
    create  .copier-answers.yml
    create  .env

# answer to the questions
$ git add .copier-answers.yml && git commit -m "+answers"
$ ls .env
.env
$ copier update
# answer to the questions
Copying from template version 0.0.0.post10.dev0+a4f9293
 identical  .
 identical  .copier-answers.yml
 identical  .env

$ ls .env
error: file not found

Logs

No response

Expected behavior

  1. consistency

after copier copy && git add . && git commit -m""
copier update shoud not change a thing

  1. feature

I expect to manage gitignored files with copier

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Ubuntu

Copier version

copier 7.2.0

Python version

Python 3.11.2

Installation method

pip+pypi

Additional context

Why I gitignore some files ?

I have a setup with two templates, one with answers shared with the team (project structure), and another with answsers not shared (db credentials, user related config...).
I make use of https://copier.readthedocs.io/en/stable/configuring/#applying-multiple-templates-to-the-same-subproject

@hparfr hparfr added bug triage Trying to make sure if this is valid or not labels May 24, 2023
@yajo yajo added this to the Soon milestone May 30, 2023
@yajo yajo removed the triage Trying to make sure if this is valid or not label Jun 1, 2023
@hparfr
Copy link
Contributor Author

hparfr commented Oct 13, 2023

This bug is still present in copier 8.3.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants