Actually harden .gitignore against a node_modules symlink - #32
Merged
Conversation
The other half of #31, which I said was in that PR and was not: I edited both .gitignore files but only `git rm` had staged anything, so the commit carried the deleted symlink and neither ignore change. The symlink is gone from main; the rule that would have stopped it going in was never committed. `node_modules/` with a trailing slash means "a directory of that name". A symlink is not a directory, which is why nothing matched the one I committed in #30. Without the slash it matches both. Verified on this branch, not on an unstaged working tree: with the change staged, re-creating the same symlink leaves `git status` clean and `git check-ignore -v web/node_modules` reports `web/.gitignore:3`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Correction
This is the half of #31 that I claimed had landed and had not.
In #31 I edited both
.gitignorefiles and rangit rmon the symlink, then committed without staging the edits —git rmstages by itself, theseddid not, and I read theMingit statusas staged. So #31 removed the symlink (that part is real and verified:mainhas nonode_modulesblob) but shipped none of the rule that would stop the next one.The change
node_modules/— trailing slash — means a directory of that name. A symlink is not a directory, which is exactly why nothing matched the one I committed in #30. Dropping the slash matches both.Two characters, two files.
Verification
Run on this branch with the change staged, not on an unstaged working tree — which is the mistake being corrected:
The symlink no longer appears as untracked.