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

All generated .gitignore files should gitignore themselves #2141

Closed
bartlangelaan opened this issue Mar 30, 2020 · 1 comment
Closed

All generated .gitignore files should gitignore themselves #2141

bartlangelaan opened this issue Mar 30, 2020 · 1 comment
Milestone

Comments

@bartlangelaan
Copy link

Is your feature request related to a problem? Please describe.
I'm currrently trying out ddev in a couple of Drupal 8 projects. The ddev config command makes it very easy to add ddev to these projects.

As soon as I start the project with ddev start, new files are generated to make my site compatible with ddev. That's awesome! However, there are multiple files that are generated but not .gitignored.

My full list of files that I'm able to add to git, are:

  • .ddev/config.yaml
  • drush/.gitignore
  • drupal/web/sites/default/.gitignore

I think it would be better if there are less automatically generated files that can be added to git.

Describe the solution you'd like
If all .gitignore files would contain this line:

/.gitignore

then the .gitignore files themselves would be gitignored. That way, this would be the only file available for git:

  • .ddev/config.yaml

Of course, if someone wants to change these .gitignore files they can still do that and the file would be marked "User-managed". That way, everyone can still add the files to git if they really want to.

Describe alternatives you've considered
Two other options I have:

  1. Add .gitignore to the files myself, and remove the #ddev-generated to make them "User-managed". But that way, I would have to do that every time I'm trying out ddev in a project.
  2. Just commit the .gitignore files and deal with it :-)

Additional context

I don't know Go at all, and I don't know about the internal infrastructure of ddev. But I think I found the two lines that would need to change, if this would be implemented. But I could be wrong ;-)

Remove ".gitignore" from this line (so it won't be added to the file twice):
https://github.com/drud/ddev/blob/1c1a287d8d391bd91189266dcda4c8db59459762/pkg/ddevapp/config.go#L917

Add "/.gitignore" to the gitignore template, between these two lines:
https://github.com/drud/ddev/blob/1c1a287d8d391bd91189266dcda4c8db59459762/pkg/ddevapp/utils.go#L198-L199

That way, every ".gitignore" that is created and managed by ddev will have a "/.gitignore" entry. I think.

@rfay rfay changed the title Let all generated gitignore files ignore themselves Let all generated .gitignore files gitignore themselves Mar 30, 2020
@rfay rfay changed the title Let all generated .gitignore files gitignore themselves All generated .gitignore files should gitignore themselves Mar 30, 2020
@truls1502
Copy link
Contributor

This part has been a bit annoying for DDEV Teams purpose, so I am agreed to remove the line /.gitignore on .ddev/.gitignore if possible 😅

But so far I have managed to do ONLY in ddev-folder:

  1. Remove the auto-generated message on top
  2. and change from /.gitignore to !/.gitignore
  3. Committed the .gitignore-file in our repo.

But hopefully, we can remove the line about /.gitignore and able to let us commit it since I have noticed that ddev start didn’t generate such file, only when doing ddev config. Otherwise, let ddev start generate this file if it doesn’t exist.

Also, (an off-topic), in web/sites/.gitignore I usually add two more lines like when using drupal/core-composer-scaffold:

default/default.services.yml
default/default.settings.php

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

No branches or pull requests

3 participants