Skip to content

Update Worktrees when the file system changes - #15

Merged
nathansobo merged 104 commits into
masterfrom
rescan
Apr 27, 2021
Merged

Update Worktrees when the file system changes#15
nathansobo merged 104 commits into
masterfrom
rescan

Conversation

@nathansobo

@nathansobo nathansobo commented Apr 13, 2021

Copy link
Copy Markdown
Contributor
  • Index worktree entries by inode
  • Add a basic failing test
  • Handle file system events
  • Randomized test
  • Handle hard links properly
  • Handle changes to .gitignore files
  • Make sure ignored files don't show up in the file-finder
  • Handle removal of .gitignore files
  • Re-render tab titles immediately when files are renamed
  • Avoid crash when deleting a file for an open buffer (when rendering its title)
  • Fix fuzzy-finding for paths with capital letters
  • Ensure files in .git directory are ignored
  • Test with extreme paths
    • Root volume
    • Directories with weird permissions

@nathansobo nathansobo changed the title WIP: Update the Worktree when the file system changes WIP: Update Worktrees when the file system changes Apr 13, 2021
@nathansobo
nathansobo force-pushed the rescan branch 2 times, most recently from 8832fe2 to be8237d Compare April 14, 2021 01:41
nathansobo and others added 11 commits April 13, 2021 20:07
The easy-parallel crate spawned new threads on each call, which was resulting in way too many threads.

Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
This will allow us to re-parent elements when re-scanning when the file system changes.
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
Co-Authored-By: Brooks Swinnerton <934497+bswinnerton@users.noreply.github.com>
nathansobo and others added 15 commits April 14, 2021 11:09
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Antonio Scandurra <me@as-cii.com>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Take a callback instead of an mpsc Sender. The
run method blocks and invokes the callback for
each batch of events. The caller controls the
threading. The callback can return false to terminate
the event stream.

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
We're going to need something that can be moved to a background thread. Worktree used to be easy to clone, but that's no longer really true. Instead we can take a snapshot.
as-cii and others added 3 commits April 26, 2021 20:10
Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
@nathansobo
nathansobo merged commit d31f2de into master Apr 27, 2021
@nathansobo
nathansobo deleted the rescan branch April 27, 2021 02:35
Anthony-Eid pushed a commit to Anthony-Eid/zed that referenced this pull request Aug 7, 2024
rtfeldman added a commit that referenced this pull request Feb 5, 2026
- Fix #6: Shell parser now includes redirect targets in normalized command string.
  'echo hello > /etc/passwd' now normalizes to include '/etc/passwd' so deny
  patterns can match writes via redirects. fd-only redirects (2>&1) handled gracefully.
- Fix #15: Test harness PermTest::run now panics on invalid regex patterns instead
  of silently dropping them via filter_map. Uses unwrap_or_else with descriptive
  panic message for all three pattern lists.
m-bers pushed a commit to m-bers/zed that referenced this pull request Apr 19, 2026
…elix-your-grep-tool

Truncate long lines in grep tool output to prevent context window blowups
Sipaha pushed a commit to Sipaha/spk-editor that referenced this pull request May 5, 2026
Adds a `[target.x86_64-unknown-linux-gnu]` block to `.cargo/config.toml`
forcing `-fuse-ld=mold` for ~5-10x faster links and lower peak RAM vs
system `ld`. Documents the requirement in README.md and records the
rationale as FORK.md decision zed-industries#15.
Sipaha added a commit to Sipaha/spk-editor that referenced this pull request May 6, 2026
Adds a `[target.x86_64-unknown-linux-gnu]` block to `.cargo/config.toml`
forcing `-fuse-ld=mold` for ~5-10x faster links and lower peak RAM vs
system `ld`. Documents the requirement in README.md and records the
rationale as FORK.md decision zed-industries#15.
Sipaha added a commit to Sipaha/spk-editor that referenced this pull request May 19, 2026
…ask zed-industries#18)

Replaces the inline-base64 image flow with proper chunked upload.
Wire is binary WebSocket frames (no JSON, no base64). 16-byte header
(u64 upload_id + u64 offset, BE) prefixes each chunk's raw bytes.
Server buffers chunks in tmp files keyed by server-generated u64 id;
1h TTL GC. send_message_blocks resolves spk-upload://<id> ResourceLinks
into acp::ContentBlock::Image just before forwarding to ACP, so the
agent sees the same Image block as today. Mobile starts upload the
moment a file is picked; UI shows per-attachment progress; Send is
gated until all uploads complete. Reconnect resume via upload_status;
force-kill resume via per-server EncryptedSharedPreferences. WS cap
dials back from 32 MiB (zed-industries#15 hotfix) to 1 MiB once chunked lands.
ShalashaskaOcelot pushed a commit to ShalashaskaOcelot/zed that referenced this pull request Jul 10, 2026
…do shortcuts

Addresses several notebook keyboard-shortcut issues:

- a/b (and the + toolbar buttons) now insert a cell and stay in COMMAND mode
  (select it, focus the notebook) instead of jumping into edit mode, so
  follow-up single-key shortcuts keep working (bug zed-industries#13).
- Sync mode to focus: when the notebook root gains focus, force command mode
  (cx.on_focus), reducing the focus/mode desync that left shortcuts stuck
  (bug zed-industries#15).
- Bind Escape to EnterCommandMode in the base NotebookEditor context (not just
  edit mode) as a recovery path.
- Add ctrl-z / ctrl-shift-z for cell undo/redo in addition to z / shift-z.

Tracking: archive phase 10 (stop-on-error + interrupt/restart queue-clear
confirmed) and bug 10 (kernel picker Enter confirmed); rewrite phases 7/8/9/10
files so implemented tasks are checked (were left unchecked); update bug 3
(interrupt delivered + cancels batch; time.sleep delay is a known Windows
limitation), file bug 15 (focus/mode desync), backlog immediate-interrupt via
GenerateConsoleCtrlEvent and focus-return-after-chrome.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eseBDGa7au9r2VxBHeh9X
ShalashaskaOcelot pushed a commit to ShalashaskaOcelot/zed that referenced this pull request Jul 10, 2026
…de on run

Rebind notebook cell copy/cut/paste from the invented single-key c/x/v to the
OS-standard clipboard combos (ctrl/cmd-c, ctrl/cmd-x, ctrl/cmd-v) in the
command-mode context. Edit mode keeps text copy/cut/paste. Free the base
ctrl-c/cmd-c binding (was InterruptKernel, shadowed everywhere) and move
interrupt to the Jupyter-standard `i i` in command mode; the toolbar Stop
button is unchanged.

Make Run (ctrl/cmd-enter) always return to command mode after executing so the
cursor leaves the editor and command-mode shortcuts keep working.

Archive phase 8 (undo/redo confirmed working). Reopen phase 7 for the rebind
and add phase 11 for the run-to-command-mode change; update bug zed-industries#15.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eseBDGa7au9r2VxBHeh9X
ShalashaskaOcelot pushed a commit to ShalashaskaOcelot/zed that referenced this pull request Jul 15, 2026
… 32)

- Esc while already in command mode collapses a multi-cell selection back to
  the primary cell, VS Code style; Esc from edit mode still only switches
  modes.
- The output "…" menu's Copy/Collapse/Clear entries now re-select their cell
  via PlainClick when done, returning keyboard focus to the notebook so
  command-mode shortcuts work immediately after menu interactions (bug zed-industries#15
  follow-up). Cell-toolbar buttons already refocused via
  handle_cell_toolbar_action.
- Markdown preview render-on-exit-edit was already wired (editor Blurred →
  FinishedEditing → reparse) — verified, listed for runtime confirmation.

Phase 32 complete; phase 35 (prompt Windows interrupt of C-blocking calls
via CTRL_BREAK process groups) promoted to keep 5 phases in rotation
(now 29, 31, 33, 34, 35).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eseBDGa7au9r2VxBHeh9X
ShalashaskaOcelot pushed a commit to ShalashaskaOcelot/zed that referenced this pull request Aug 6, 2026
Audited every CHANGELOG claim against the code: all phase and bug entries are
genuinely implemented (symbol checks for each), and every commit hash inside
this shallow clone's history resolves to the work it claims. Nothing needed
pulling out for review.

Fixes found along the way:
- Bugs zed-industries#47 and zed-industries#54 were archived as user-confirmed by c199237 but that commit
  never deleted their bugs.md entries, so both were double-tracked. Removed.
- Bug zed-industries#63 was still "open — needs a decision" although phase 59 implemented the
  decided behaviour. Moved to fix attempted - untested with the fix recorded.
- Bugs zed-industries#7, zed-industries#15 and zed-industries#20 sat at fix attempted - untested with no pointer in the
  testing ledger, so they were invisible there. Added with test recipes.
- Bug zed-industries#56's changelog hash was a transposition (c199273c199237).

Phases 59 and 60 are implementation-complete with only manual tests left, so
their test items move to awaiting_testing.md and the phase files are recorded
in the changelog and deleted. Six phases remain in rotation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HUB73REGigaN5TCgvSkM2s
jolutz pushed a commit to jolutz/zed that referenced this pull request Aug 8, 2026
Update Worktrees when the file system changes
audivir added a commit to audivir/zed that referenced this pull request Aug 10, 2026
…font scans

Closes out High zed-industries#9 and Medium zed-industries#15 from BUG_REPORT.md:

- resolve_project (walks parent directories checking typst.toml/main.typ -
  real filesystem I/O) ran synchronously in schedule_typst_update's
  foreground view.update closure on every debounced edit. It's now a plain
  (project_resolution: bool, active_path: &Path) function with no view
  dependency, called from the existing cx.background_executor() block
  instead; needs_new_world/world_arc selection moved there too since it
  depends on the resolved root. Covered by four new tests in
  typst_preview_view.rs exercising resolve_project directly.
- TypstSystemWorld::new re-scanned every system font and re-parsed every
  bundled asset font on every project-root switch, even though neither
  depends on the root. Bundled + system fonts are now scanned once per
  process into a cached static_fonts() OnceLock<(FontBook, Vec<FontSlot>)>
  (FontSlot is now Clone); new() clones that and layers a fresh, root-scoped
  load_fonts_dir(&root) scan on top. Covered by two new tests in
  typst_world.rs.

Also investigated the "path-normalization mismatch on symlinked roots" Low
finding: traced worktree::LocalFile::abs_path to confirm Zed deliberately
never canonicalizes worktree roots anywhere, so the mismatch this described
is only reachable across multiple worktrees with divergent symlink paths to
the same file - narrower than originally flagged, and fixing it locally
would cut against that codebase-wide convention. Left open, documented in
BUG_REPORT.md with the concrete reproduction condition instead of a fix.

BUG_REPORT.md and TEST_PLAN.md updated to reflect what's fixed/tested now.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
audivir added a commit to audivir/zed that referenced this pull request Aug 10, 2026
…font scans

Closes out High zed-industries#9 and Medium zed-industries#15 from BUG_REPORT.md:

- resolve_project (walks parent directories checking typst.toml/main.typ -
  real filesystem I/O) ran synchronously in schedule_typst_update's
  foreground view.update closure on every debounced edit. It's now a plain
  (project_resolution: bool, active_path: &Path) function with no view
  dependency, called from the existing cx.background_executor() block
  instead; needs_new_world/world_arc selection moved there too since it
  depends on the resolved root. Covered by four new tests in
  typst_preview_view.rs exercising resolve_project directly.
- TypstSystemWorld::new re-scanned every system font and re-parsed every
  bundled asset font on every project-root switch, even though neither
  depends on the root. Bundled + system fonts are now scanned once per
  process into a cached static_fonts() OnceLock<(FontBook, Vec<FontSlot>)>
  (FontSlot is now Clone); new() clones that and layers a fresh, root-scoped
  load_fonts_dir(&root) scan on top. Covered by two new tests in
  typst_world.rs.

Also investigated the "path-normalization mismatch on symlinked roots" Low
finding: traced worktree::LocalFile::abs_path to confirm Zed deliberately
never canonicalizes worktree roots anywhere, so the mismatch this described
is only reachable across multiple worktrees with divergent symlink paths to
the same file - narrower than originally flagged, and fixing it locally
would cut against that codebase-wide convention. Left open, documented in
BUG_REPORT.md with the concrete reproduction condition instead of a fix.

BUG_REPORT.md and TEST_PLAN.md updated to reflect what's fixed/tested now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants