Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
composer
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
24 Feb 2020 at 15:43 UTC
Updated:
24 Mar 2020 at 10:19 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
martijn.cuppens commentedComment #3
jeroentComment #4
jeroentComment #5
jeroentComment #6
martijn.cuppens commentedComment #8
martijn.cuppens commentedComment #9
jeroentComment #10
jungleshould add leading / to build too and update test(s)
Comment #11
martijn.cuppens commentedComment #12
martijn.cuppens commentedComment #13
martijn.cuppens commentedAha, there was already a
.gitignorefile somewhere. I was wondering where thatbuildfolder was coming from.Comment #14
jungleCool, you're quick!
Added a newline at end of file to file
Comment #15
martijn.cuppens commentedInitially had that too, but then I removed it since we might also need to test the case where we don't have a newline at end of file?
Comment #16
jungleSorry, a wrong interdiff attached, corrected.
Comment #17
jungleYes, maybe adding it is off the topic here, let's wait for others to give a comment. :p
Comment #18
jeroentPatch looks sane to me.
Comment #19
mile23To me the principle should be: If you scaffold a file, you can say whether to add that specific file to .gitignore.
If you scaffold
[web-root]/arbitrary/path/robots.txt, then you should be able to add/arbitrary/path/robots.txtto[web-root]/.gitignore, with the leading slash so it's that one file being ignored.If that's the desired behavior, then we need a test of whether the patch does that for subdirectories.
Set to NR because I think maybe @greg.1.anderson should chime in.
Comment #20
greg.1.anderson commentedYes, this is exactly right -- and exactly how we should have written it the first time.
The scaffold tool first asks git if the file being scaffolded has been ignored; you can ignore it via whatever conventions you wish, and so long as it is ignored, the scaffold tool will not add its own entry for that file anywhere.
If the file is not ignored, and the scaffold tool is configured to ignore scaffold files, then it is better for it to add the leading slash so that other similarly-named files deeper in the hierarchy are not also ignored.
I tend to think that the current level of testing is fine. Now that we are adding the leading slash, I feel it is overkill to have a test that checks to see if `git check-ignore` respects the slash for subdirectories. I think the existing unit tests that check to see that the .gitignore contents are correct are sufficient without adding said functional tests.
Thanks for fixing this.
Comment #21
martijn.cuppens commentedComment #22
alexpottCommitted and pushed e3e5937d5c to 9.0.x and 2784f6a4b7 to 8.9.x. Thanks!
Comment #25
alexpottWill backport to 8.8.x once the freeze is over.
Comment #26
alexpottAs this is a bugfix to non-runtime code backpotted to 8.8.x as it is not risky.