mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-10 03:27:59 +00:00
docs(ignore): link ignore package docs for bare-name normalization
Adds references to the `ignore` package documentation in both the childrenIgnored comment and the bare-negation test, explaining why `!iOS` (without trailing slash) also re-includes the iOS/ directory. Addresses non-blocking review suggestion on #654. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
91b88202de
commit
17560eccb2
2 changed files with 6 additions and 3 deletions
|
|
@ -402,7 +402,9 @@ export const createIgnoreFilter = async (repoPath: string, options?: IgnoreOptio
|
|||
// a trailing slash. This ensures directory-only negation patterns (e.g.
|
||||
// `!iOS/`) are applied correctly — without the slash, `ig.ignores('iOS')`
|
||||
// treats the path as a file and misses the negation.
|
||||
// Bare-name patterns (e.g. `local`) still match `local/` per gitignore spec.
|
||||
// Bare-name patterns (e.g. `local`) still match `local/` per gitignore spec:
|
||||
// the `ignore` package normalizes `dir` and `dir/` to match directories.
|
||||
// See: https://github.com/kaelzhang/node-ignore#2-filenames-and-dirnames
|
||||
if (ig) {
|
||||
const rel = p.relative();
|
||||
if (rel && ig.ignores(rel + '/')) return true;
|
||||
|
|
|
|||
|
|
@ -364,8 +364,9 @@ describe('createIgnoreFilter', () => {
|
|||
|
||||
it('childrenIgnored respects negation patterns without trailing slash (!dir vs !dir/)', async () => {
|
||||
// Per gitignore spec: `!iOS` (no slash) negates both files and directories
|
||||
// named `iOS`, while `!iOS/` is directory-only. The `ignore` package should
|
||||
// normalize both forms so that `ig.ignores('iOS/')` returns false in either case.
|
||||
// named `iOS`, while `!iOS/` is directory-only. The `ignore` package
|
||||
// normalizes both forms so that `ig.ignores('iOS/')` returns false in either case.
|
||||
// Ref: https://github.com/kaelzhang/node-ignore#2-filenames-and-dirnames (see #596)
|
||||
await fs.writeFile(path.join(tmpDir, '.gitnexusignore'), '*\n!iOS\n!iOS/**\n');
|
||||
const filter = await createIgnoreFilter(tmpDir);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue