Skip to content

Fix symlinked gitignored paths in code review#11856

Merged
MaggieShan merged 7 commits into
masterfrom
maggs/filter-gitignored-paths-for-repometadata
Jun 2, 2026
Merged

Fix symlinked gitignored paths in code review#11856
MaggieShan merged 7 commits into
masterfrom
maggs/filter-gitignored-paths-for-repometadata

Conversation

@MaggieShan
Copy link
Copy Markdown
Contributor

@MaggieShan MaggieShan commented May 28, 2026

Description

  • Context: https://warpdotdev.sentry.io/issues/7511484182/events/18c59c5b820d4bd7af362160ad91938b/?project=5658526
  • We're getting a group of sentry errors related to git commands failing due to being outside the repo (eg. Git command failed: fatal: <path>/node_modules/<path>' is outside repository)
  • As per oz's investigation https://staging.warp.dev/conversation/e7f00920-692d-4314-86e3-adcb65c11ff9
    • The DirectoryWatcher's file watcher is registering gitignored directories like node_modules which follows its symlink entries and ends up registering paths outside the active repo => this means that we'd receive file watcher events for these file changes and fail to run commands like git diff -- <file>
  • For symlinked paths like those in node_modules we weren't correctly attributing the file paths to their correct repositories which resulted in an inaccurate is_ignored value
    • This resulted in files that should've been ignored being queued for invalidation and failing with "is outside repository"
  • The fix includes updating how we derive is_ignored such that we're checking for the non-canonicalized paths which don't follow the symlinks

Linked Issue

APP-4632

Testing

  • Reproed error log + confirmed it no longer shows with fix
  • I have manually tested my changes locally with ./script/run

Agent Mode

  • Warp Agent Mode - This PR was created via Warp's AI Agent Mode

@cla-bot cla-bot Bot added the cla-signed label May 28, 2026
@MaggieShan MaggieShan changed the title Filter gitignored paths for RepoMetadata Filter gitignored paths for DirectoryWatcher May 29, 2026
@MaggieShan MaggieShan marked this pull request as ready for review May 29, 2026 20:20
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 29, 2026

@MaggieShan

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Copy link
Copy Markdown
Contributor

@oz-for-oss oz-for-oss Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR threads gitignore information into the repository DirectoryWatcher filter so recursive watches can prune ignored directories such as node_modules, while keeping the local repo metadata watcher on the previous unpruned behavior.

Concerns

  • The new gitignore filtering is also applied to .git/ paths after the existing allowlist, so repo/global ignore patterns can suppress the git-internal events this watcher must preserve.
  • No approved spec context was available for this PR, and I found no separate security findings.

Verdict

Found: 0 critical, 1 important, 0 suggestions

Request changes

Comment /oz-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Comment thread crates/repo_metadata/src/entry.rs Outdated
MaggieShan and others added 3 commits June 1, 2026 11:17
Reverts LRMM to use repo_watch_filter without gitignore pruning so the
file tree UI continues to receive real-time updates for files inside
gitignored directories (e.g. expanded node_modules/). The .git/
allowlist still applies via the empty-gitignore variant.

Only DirectoryWatcher (which feeds code review / Repository
subscribers) needs the gitignore-aware filter to prevent
cross-repo events from pnpm symlinks.

Co-Authored-By: Oz <oz-agent@warp.dev>
@MaggieShan MaggieShan force-pushed the maggs/filter-gitignored-paths-for-repometadata branch from d44c060 to 45e8736 Compare June 1, 2026 15:17
@MaggieShan MaggieShan requested a review from kevinyang372 June 1, 2026 15:28
Comment thread crates/repo_metadata/src/entry.rs Outdated
Comment thread crates/repo_metadata/src/entry.rs Outdated
@MaggieShan MaggieShan changed the title Filter gitignored paths for DirectoryWatcher Fix symlinked gitignored paths in code review Jun 2, 2026
@MaggieShan MaggieShan merged commit 9f45984 into master Jun 2, 2026
46 checks passed
@MaggieShan MaggieShan deleted the maggs/filter-gitignored-paths-for-repometadata branch June 2, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants