Problem/Motivation
The core-composer-scaffold plugin has the capability to manage .gitignore files for scaffolded files. This feature can be enabled or disabled in the top-level composer.json file. If it is neither enabled or disabled, then the default value is that the feature auto-disables if the current project is not managed in a git repository, or if the vendor
directory has been committed already, and is otherwise enabled.
The default behavior presents a problem for the composer create-project
command, because in this instance, there is always a git repository for the new site on the first run of the scaffold operation (create-project
asks at the very end if the repository should be kept or removed), but it will never be the case that the vendor
directory will be committed. The result is that the user ends up with a collection of .gitignore files, whether they wanted them or not.
Currently, the only way around this is to ensure that all of the initial scaffold files are .gitignored in the source project.
Proposed resolution
We can avoid this problem if we invert the default behavior of the .gitignore management feature:
- Management of .gitignore files is disabled by default.
- If the user has proactively .gitignored the vendor directory (and not explicitly enabled or disabled .gitignore management in composer.json), then the feature will be automatically enabled.
Remaining tasks
Change the code.Update the Scaffold plugin README
User interface changes
None
API changes
None
Data model changes
None
Release notes snippet
n/a
Comment | File | Size | Author |
---|---|---|---|
#3 | 3085354-2-to-3-interdiff.txt | 700 bytes | greg.1.anderson |
#3 | 3085354-3.patch | 1.41 KB | greg.1.anderson |
#2 | 3085354-2.patch | 739 bytes | greg.1.anderson |
Comments
Comment #2
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedUpdate issue summary with more accurate description of the problem, and upload a patch.
Comment #3
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedForgot to update README.
Comment #4
hussainwebThis LGTM. Two things:
- Does this need a CR? I checked previous change records and I didn't see this feature mentioned. I think a CR may not be strictly necessary.
- The documentation should be updated at https://www.drupal.org/docs/develop/using-composer/using-drupals-compose...
Comment #5
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedThanks; I updated the documentation page.
Since this bugfix is so minor, I thought few would have even noticed it at this point, and a CR was therefore superfluous. I'll write one up if anyone thinks it would be beneficial though.
Comment #6
hussainwebAdd to that, the feature is not out in a stable release yet, so I don't think a CR is necessary.
Thanks for updating the documentation.
Comment #7
mbayntonDeconstructing this a bit so I can do an end-to-end create-project test with it in play. I was a little surprised to see this as a patch against Drupal and not a separate project for the scaffold plugin. Am I right that what that's about is someone said the authoritative copy needs to be in the One Drupal Source Tree, and so then it gets subtree split?
Comment #8
mbayntonSo that's weird, didn't intend to un-RTBC at this time.
Comment #9
greg.1.anderson CreditAttribution: greg.1.anderson at Pantheon commentedYes, that's right: the source for the scaffold plugin is in the drupal/drupal git repository. The drupal.org infrastructure makes a subtree split from every directory in the repository that contains a composer.json file. Each of these split-out projects are exported under the "drupal" org on GitHub.
Comment #10
mbayntonI tested this in combination with the issue that prompted it, #3082958: Add gitignore(s) to Composer-ready project templates, and confirmed that it fixes the issue. The scaffold plugin does not modify the pristine .gitignore from the project template that we're trying to supply as a starting state.
Comment #11
alexpottCommitted 2296602 and pushed to 8.8.x. Thanks!