Skip to content

Commit db8a5f5

Browse files
committed
Anchor the .gitattributes entries to the repo root
Copilot: the six entries were unanchored basename patterns, so git applied them at any depth. Measured before the fix: some/deep/dir/.pylintrc text: set .codex/skills/ruleset.xml text: set sub/.bandit text: set That directly contradicts this PR's own claim -- "no pattern, so no file outside the named six can be affected." A .gitattributes pattern with no slash is a basename match, exactly like .gitignore. Which is the same trap I documented in #953 one PR earlier, in the other direction. Each entry now carries a leading slash. Verified after: root .bandit/.pylintrc/.remarkrc/.shellcheckrc/.stylelintrc/ruleset.xml text: set (unchanged) some/deep/dir/.pylintrc text: unspecified (was: set) .codex/skills/ruleset.xml text: unspecified (was: set) sub/.bandit text: unspecified (was: set) RSS.xml text: unspecified (unchanged) The comment now explains the anchoring alongside the `*.xml` note, since the two traps have the same root cause: git pattern matching is path-anchored only when the pattern contains a slash. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EBV6TkrwsZhcwkh1b6NUHs
1 parent 5079057 commit db8a5f5

1 file changed

Lines changed: 10 additions & 6 deletions

File tree

.gitattributes

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,15 @@
114114
# set; anything unspecified is skipped and counted as a gap. Without these,
115115
# the configs added in #950 join that bucket.
116116
#
117+
# Leading slashes anchor these to the repo root. Without one, a .gitattributes
118+
# pattern with no slash is a BASENAME match at any depth -- the same rule as
119+
# .gitignore -- so a bare `.pylintrc` would also claim any nested one.
120+
#
117121
# NOT `*.xml`: RSS.xml is committed with CRLF, and a blanket `text eol=lf`
118122
# would rewrite its line endings as a side effect of declaring a config file.
119-
.bandit text eol=lf
120-
.pylintrc text eol=lf
121-
.remarkrc text eol=lf
122-
.shellcheckrc text eol=lf
123-
.stylelintrc text eol=lf
124-
ruleset.xml text eol=lf
123+
/.bandit text eol=lf
124+
/.pylintrc text eol=lf
125+
/.remarkrc text eol=lf
126+
/.shellcheckrc text eol=lf
127+
/.stylelintrc text eol=lf
128+
/ruleset.xml text eol=lf

0 commit comments

Comments
 (0)