Problem/Motivation
The example.gitignore in core root and core/assets/scaffold/files could be improved.
Specifically, updates could be used that:
- Account for more permutations in multisite/environment specific configuration file names
- Explicitly allow the default template files that got ignored by the new gitignore rules since it can be useful to keep those as reference
- Do the same for gitignore setups where the gitignore is places in sites/ folder.
Steps to reproduce
- View the example.gitignore.
- It does not have very robust rules for ignoring settings and services files.
Proposed resolution
Update example.gitignore and core/assets/scaffold/files to change
sites/*/settings*.php
sites/*/services*.yml
to
sites/*/*settings*.php
sites/**/*services*.yml
!sites/*/default.settings.php
!sites/*/default.services.yml
Then, add to the section if you prefer to store your .gitignore file in the sites/ folder
with
# */*settings*.php
# !*/default.settings.php
# !sites/*/services.yml
# !*/default.services.yml
Remaining tasks
Update the example.gitignore files to better account for multisite/environment specific configurations.
View the example.gitignore in core root and core/assets/scaffold/files.
The file now has more robust but still sensible gitignore policies that cover multisite/environment specific configurations.
While there are more permutations of settings and services files that are ignored, there are also explicit allow rules for certain files that do not need to be ignored.
These rules are reflected also in the section for setups where the gitignore is in the sites/ folder.
| Comment | File | Size | Author |
|---|
Issue fork drupal-2381091
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2381091-development.services.yml-is-not
changes, plain diff MR !13593
Comments
Comment #1
mikeker commentedComment #2
mikeker commentedDang it... I never remember to set the status!
Comment #3
mikeker commentedLooks like I, and those in #2326913: Add sites/*/*services*.yml to example.gitignore, missed that we need to make this change to the commented out section of the example gitignore file as well... Bumping to priority to normal since the current
example.gitignoredoesn't include anything aboutservices.ymlfiles if the.gitignoreis located in the sites directory.Comment #4
dawehnerWell, I would argue that you maybe actually want to have some of those in GIT, especially if you have production files, you want to track as well.
Excluding all of them by default is maybe a little bit too much, to be honest.
Comment #5
mikeker commented@dawehner: Agreed -- I usually checking settings.php into the repo. But this is just an example
.gitignorefile and meant to be modified. Since there is no longer a.gitignorein Drupal core there is no worry about it being overwritten with each core update. The hope is that someone new to Drupal can just copy/paste the example file and not accidentally check-in potentially sensitive information. More experienced devs will modify it to suit their needs.This also treats
local.settings.phpthe same assettings.local.php. Previously onlysettings.local.phpwas ignored.Comment #6
dawehnerMaybe we could explicit allow
example.*services*.ymlandexample.*settings*.ymlwhich itself is an example what you want to have in your repo?Comment #7
mikeker commentedReroll after #1975220: Allow a Composer user to manage Drupal, modules, and PHP dependencies with a custom root composer.json.
re: #6: we have a
default.settings.phpanddefault.services.phpalong withexample.gitignore. I would support renaming the first two to start with example, just for consistency and the fact that neither file is actually used as a default anything. But I think that's a debate that'll be postponed until D9 (at the earliest! :)Comment #8
mikeker commentedPatch still applies...
Comment #9
dawehnerLet's get it in.
Comment #10
wim leerss/php/yml/ … or am I mistaken?
Comment #11
mikeker commented@Wim Leers: Not mistaken, completely correct!
Fixed in the attached patch.
Comment #12
wim leersLovely :)
Comment #13
alexpottIsn't a problem with this that (for example) default.settings.php is in git?
Comment #14
mikeker commentedNot if those files are already in the repo. The .gitignore file only ignores new files -- from the Git manpages:
So a core contributor wanting to change
default.settings.phpwould see their change when they rungit status. If we wanted to add anexample.settings.phpfile, it would require overriding our existing.gitignoreto do so, but core contributors should be comfortable doing so and, since.gitignoreis not a tracked file, it would not appear in the diff.Comment #15
jeanfei commentedI think it should be better to specify that the default.settings.php is in git.
I've add new lines in example.gitignore for this.
Comment #16
mikeker commented@jeanfei, agreed, specifically adding default.settings.php makes it clearer what is and is not in the repo. Thanks for the addition.
Patch still applies cleanly to HEAD. Added beta eval to the issue summary and, since this is a followup to a task, I changed issue type.
Comment #17
mikeker commentedComment #18
joelpittetLooks good a bit confusing based on the title which the patch addresses but doesn't but does:)
Comment #19
alexpottLet's do the same for default.services.yml as we've done for default.settings.php
Comment #20
mikeker commentedDone.
Comment #21
wim leersdefault.services.yml, not default.services.php.
Comment #22
mikeker commentedYikes! Sorry about that -- pre-coffee copy/pasting is dangerous... :)
Fixed.
Comment #24
sasanikolic commentedDid we forget
development.services.yml? I have it insites/development.services.yml... or should I move it into sites/default?Comment #25
rajeshwari10 commentedHi
I have kept development.services.yml in sites folder as it is in drupal 8.1.x.
Just added the path sites/development.services.yml in git ignore. I had just given a try.
Please review.
Thanks!!
Comment #27
rajeshwari10 commentedComment #29
lluvigneRerolled patch on #22 (i think that patch on #25 is not ok, maybe with this you can make the change, i don't know).
Comment #31
gnugetThis still doesn't address #24.
whether we have or not to move the development.services.yml to site/default the default place of that file is /sites/ and IMO we should ignore it there by default.
Comment #32
gnugetLet's see if this can push this forward.
Comment #33
shadcn commentedWouldn't this line here ignore modules' services.yml files in a multisite configuration?
Comment #34
gnugetYup, you are right. that line is even going to ignore /sites/default/services.yml file :-|
We need add an extra line there with something like:
Thanks for your review, this definitely needs work.
Comment #35
gnugetComment #36
xjmComment #37
sidharthapUpdated patch.
Comment #38
gnugetHi sidharthap.
Thanks for your patch, when a new patch is uploaded is necessary provide the interdiff as well.
Can you please upload it?
Thanks!
Comment #39
gnugetI'm confuse.
Initially I thougth to we wanted to ignore all the files but settings.php and services.yml but it seems to I was wrong, we wanted to ignore all of them but example.settings.php and example.services.yml?
If that is the case then: 32 is correct.
Comment #41
joelpittetIt seems that this issue title and summary doesn't match. Please update the title and summary to explain what this issue has evolved into.
Comment #52
rassoni commented#37 is not applied not 10.x. version. no changes in patch just re-roll in 10.x.
Comment #54
ankit_rathore commented#52 failed because only changing
/example.gitignore
will not work, patch will work after adding the same lines in
/core/assets/scaffold/files/example.gitignore
I am uploading updated patch for 10.1.x-dev with interdiff
Comment #55
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue under control, following Review a patch or merge request as a guide.
This appears to need an issue summary as there seem to be more changes then what's originally listed. Using the default template would be super helpful.
===========
Just FYI to help get the message out there.
Starting March 2023, simple rerolls, rebases, or merges will no longer receive issue credit. Only rerolls that address a merge conflict will be credited, and the merge conflict that was resolved must be documented in the text of an issue comment.
To receive credit for contributing to this issue, assist with other outstanding tasks or unaddressed feedback.
See the issue credit guidelines for more information.
Comment #58
mdranove commentedComment #60
mdranove commentedComment #61
gengo_kComment #62
gengo_kThanks for your work on this issue.
I performed Novice Triage on this issue. I am leaving the Novice tag on this issue because it has a clear step to review the short MR.
Comment #63
smustgrave commentedSeems straight forward enough.
Comment #64
alexpottWhy do we need ** for services and not for settings. And the recommendation for when .gitignore is inside sites is wrong.
Comment #65
alexpottNothing about this has been quick.
Comment #66
ressaWouldn't it be more fruitful to focus on completing #3082958: Add gitignore(s) to Composer-ready project templates instead? It will place a
.gitignorefile in the project root automatically, upon creation via Composer.Also, I believe multisite installations are such a rare occurrence, that perhaps it would fit better on a documentation page?
Comment #67
xjmAt either DrupalCon Vienna or Nara I told someone verbally this needed framework manager review, which somehow never made it back onto the issue, but looks like @alexpott found it anyway which is good.
I think #66 makes sense, but is also sort of implementation details. Regardless of where it goes, we need to agree on the contents. We could mark one or the other of these issues as duplicates or at least postponed on the other.
Comment #68
xjmAlso no longer in a novice status. Thanks!
Comment #71
quietone commentedBased on #67 I am going to postpone 'the other one', #3082958: Add gitignore(s) to Composer-ready project templates. Today, it seems better to make a small, incremental fixes.
I have applied the suggestions made by alexpott and rebased.
Comment #72
smustgrave commentedRebased this one and from what I can tell all feedback has been addressed.
Comment #73
alexpottCommitted and pushed 046e7595b88 to main and 59a2ce11bb3 to 11.x. Thanks!
Comment #77
bramdriesenNice, glad to see this fixed!