Skip to content

Actually harden .gitignore against a node_modules symlink - #32

Merged
42piratas merged 1 commit into
mainfrom
fix/gitignore-symlink
Aug 3, 2026
Merged

Actually harden .gitignore against a node_modules symlink#32
42piratas merged 1 commit into
mainfrom
fix/gitignore-symlink

Conversation

@42piratas

Copy link
Copy Markdown
Contributor

Correction

This is the half of #31 that I claimed had landed and had not.

In #31 I edited both .gitignore files and ran git rm on the symlink, then committed without staging the editsgit rm stages by itself, the sed did not, and I read the M in git status as staged. So #31 removed the symlink (that part is real and verified: main has no node_modules blob) 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:

$ ln -sfn ../../../ff3e-app/web/node_modules web/node_modules
$ git status --short
M  .gitignore
M  web/.gitignore
$ git check-ignore -v web/node_modules
web/.gitignore:3:node_modules	web/node_modules

The symlink no longer appears as untracked.

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`.
@42piratas
42piratas merged commit 2bb6824 into main Aug 3, 2026
1 of 2 checks passed
@42piratas
42piratas deleted the fix/gitignore-symlink branch August 3, 2026 23:34
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

Successfully merging this pull request may close these issues.

1 participant