Skip to content

Allow ancestor directories of allowlisted git files#11321

Open
MaggieShan wants to merge 2 commits into
masterfrom
maggs/support-watching-git-directories
Open

Allow ancestor directories of allowlisted git files#11321
MaggieShan wants to merge 2 commits into
masterfrom
maggs/support-watching-git-directories

Conversation

@MaggieShan
Copy link
Copy Markdown
Contributor

@MaggieShan MaggieShan commented May 19, 2026

Description

  • Today we use a filesystem watcher to detect git changes (branch checkouts, commits, etc.) using an allowlist - this includes paths like HEAD, refs/heads/*, index.lock, and ignores paths like .git/logs/ to reduce noice
  • The issue is that on linux, the notify crate uses inotify under the hood which is non-recursive by design and registers a watch handle per directory
  • This PR updates the helper fns in should_ignore_git_path to allow the related ancestor directories to the allowlisted files and not just their files
    • Updates the relevant tests too

Linked Issue

  • APP-4528
  • I believe this also fixes the flaky test mentioned in for the same reasons CODE-1492

Testing

Repro steps:

  1. git checkout HEAD~1
  2. update base branch to master in code review view
  3. git checkout master

bug: code review would render old/inaccurate diffs
fix: code review refresh is triggered and shows clean state

https://www.loom.com/share/ea1a81e5c0654fc9a6d0f20b68f7d63e

  • I have manually tested my changes locally with ./script/run

Screenshots / Videos

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 19, 2026
@oz-for-oss
Copy link
Copy Markdown
Contributor

oz-for-oss Bot commented May 19, 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 broadens the Git watcher allowlist so Linux can register watches on ancestor directories of Git files, and it updates tests around the new behavior.

Concerns

  • Ancestor .git/refs paths are now classified as remote-tracking refs even though the watcher routing path only handles exact tracked-ref file paths, which can drop those directory events instead of routing them through commit/shared-ref handling.

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
@MaggieShan MaggieShan requested a review from kevinyang372 May 19, 2026 18:14
zerx-lab added a commit to zerx-lab/warp that referenced this pull request May 20, 2026
…n-empty"

This reverts commit 445a245, reversing
changes made to 6b83612.

撤销原因:PR #123 修复未生效。事后排查发现真根因在 terminal/view.rs 的
`should_subscribe_to_git_status` 上 —— 该函数要求 `GitDiffStats` chip 在
prompt 配置里才订阅 `GitRepoStatusModel`,导致 `MetadataChanged` 事件链路
在很多场景下根本不建立,PR #123 修改的 `MetadataChanged` handler 永远进
不去。该 PR 改的另一面(autoupdate/linux_test.rs 孤儿测试清理)随之
回退,如需保留请单独 cherry-pick 18f34ef。

后续重新调研方向:对齐上游 warpdotdev#9970(无条件订阅)
+ warpdotdev#11321(Linux inotify 监听目录而非文件)。
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.

1 participant