MoonshotAI / MoonshotAI/kimi-code

Glob searches can surface ignored files

Open
#1,244 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
7.5k
Forks
1.2k
Avg merge
11h 53m
Merged PRs (30d)
350

Description

Problem

Glob documents that it respects .gitignore, .ignore, and .rgignore by default, but broad patterns can return ignored files.

Two ripgrep behaviors cause this:

  • Broad patterns such as *, **, and **/* are passed as positive --glob filters. Positive ripgrep globs can re-include files that ignore rules would otherwise exclude.
  • Ripgrep only applies .gitignore outside git repositories when --no-require-git is set. Glob does not currently pass that flag for non-git search roots.

Reproduction

In a directory with:

.gitignore   # contains *.log
kept.ts
ignored.log

Run Glob with pattern: "*".

Expected

kept.ts is returned and ignored.log is excluded by .gitignore.

Actual

ignored.log can be returned, including in a git repo when the broad pattern is emitted as a positive --glob, and in non-git directories because .gitignore is not honored without --no-require-git.

Notes

Useful reference patterns:

  • opencode avoids a positive glob for broad discovery in its find path.
  • pi walks upward for .git and uses --no-require-git outside repos.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the TypeScript Glob entry point and trace how broad patterns become ripgrep arguments; run the provided reproduction in both a Git repository and a non-Git directory. Done means kept.ts is returned while ignored.log is excluded by .gitignore for broad patterns such as *.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
cli, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.