Skip to content

cli: Teach --diff to recurse into directories and add a MultiDiffView#45131

Merged
Veykril merged 2 commits intozed-industries:mainfrom
davidbarsky:push-tumxsnzwrzzx
Jan 30, 2026
Merged

cli: Teach --diff to recurse into directories and add a MultiDiffView#45131
Veykril merged 2 commits intozed-industries:mainfrom
davidbarsky:push-tumxsnzwrzzx

Conversation

@davidbarsky
Copy link
Contributor

@davidbarsky davidbarsky commented Dec 17, 2025

This branch:

  1. teaches --diff command line option to to recurse into folders if provided.
  2. Adds a MultiDiffView that shows all changed files in a single, scrollable view.

This is necessary to provide a smooth user experience for jj and Zed users who wish to use Zed as their jj difftool.

I'm not fully sure how this change interacts with #44936, or what plans y'all have in mind.

Here's a screenshot of the resulting behavior:

Screenshot 2025-12-17 at 9 10 52 AM

I setup zed to handle jj diffs by adding the following to my jj config:

[aliases]
zdiff = ["diff", "--tool", "zed"]

[merge-tools.zed]
program = "/Users/dbarsky/Developer/zed/target/debug/cli"
# omit diff-invocation-mode to keep the default (JJ passes two dirs)
diff-args = [
  "--zed", "/Users/dbarsky/Developer/zed/target/debug/zed",
  "--wait",
  "--new",
  "--diff",
  "$left",
  "$right",
]

Release Notes:

  • --diff, if provided with folders instead of files, will recurse into those directories.
  • Added a MultiDiffView, which will show all changed files within a single, scrollable view.

AI Disclosure: Pretty much all of this code was written using Codex with GPT-5.1-Codex. I edited by hand and tested this.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Dec 17, 2025
@Veykril Veykril self-assigned this Dec 17, 2025
@cole-miller cole-miller removed their assignment Dec 17, 2025
@davidbarsky davidbarsky changed the title Add a --diff-all cli option and corresponding MultiDiffView Teach --diff to recurse into directories and add a MultiDiffView Jan 15, 2026
@davidbarsky davidbarsky requested a review from Veykril January 15, 2026 21:52
davidbarsky and others added 2 commits January 30, 2026 08:41
The --diff option now auto-detects when directories are passed and
automatically recurses into them to find all files to diff.
@Veykril Veykril changed the title Teach --diff to recurse into directories and add a MultiDiffView cli: Teach --diff to recurse into directories and add a MultiDiffView Jan 30, 2026
@Veykril Veykril merged commit 185a80a into zed-industries:main Jan 30, 2026
27 checks passed
@davidbarsky davidbarsky deleted the push-tumxsnzwrzzx branch January 30, 2026 17:51
@tkgalk
Copy link

tkgalk commented Feb 6, 2026

With the jj config provided, doesn't seem to work on macOS.

> jj zdiff
Error: Log file creation in "/Applications/Zed Preview.app/Contents/MacOS"

Caused by:
    Operation not permitted (os error 1)
Warning: Tool exited with exit status: 1 (run with --debug to see the exact invocation
> jj zdiff --debug
2026-02-06T15:01:43.985089Z  INFO jj_cli::cli_util: debug logging enabled
2026-02-06T15:01:44.022568Z  INFO run_command:cmd_diff:workspace_helper:workspace_helper_with_stats:maybe_snapshot_impl: jj_lib::lock::unix: Attempting to lock "<SNIP>/.jj/repo/git_import_export.lock"
2026-02-06T15:01:44.023170Z  INFO run_command:cmd_diff:workspace_helper:workspace_helper_with_stats:maybe_snapshot_impl: jj_lib::lock::unix: Locked "<SNIP>/.jj/repo/git_import_export.lock"
2026-02-06T15:01:44.026468Z  INFO run_command:cmd_diff:workspace_helper:workspace_helper_with_stats:maybe_snapshot_impl:snapshot_working_copy: jj_lib::lock::unix: Attempting to lock "<SNIP>/.jj/working_copy/working_copy.lock"
2026-02-06T15:01:44.026769Z  INFO run_command:cmd_diff:workspace_helper:workspace_helper_with_stats:maybe_snapshot_impl:snapshot_working_copy: jj_lib::lock::unix: Locked "<SNIP>/.jj/working_copy/working_copy.lock"
2026-02-06T15:01:44.108608Z  INFO run_command:cmd_diff:request_pager: jj_cli::ui: spawning pager cmd=LESSCHARSET="utf-8" "less" "-FRX"
2026-02-06T15:01:44.130548Z  INFO run_command:cmd_diff: jj_cli::merge_tools::external: Invoking the external diff generator: cmd=cd "/var/folders/d2/_571cg_x0qggrx55nv1b8kjh0000gq/T/jj-diff-PU1QXi" && "/usr/local/bin/zed" "--zed" "/usr/local/bin/zed" "--wait" "--new" "--diff" "left" "right"
Error: Log file creation in "/Applications/Zed Preview.app/Contents/MacOS"

Caused by:
    Operation not permitted (os error 1)
2026-02-06T15:01:44.156642Z  INFO run_command:cmd_diff: jj_cli::merge_tools::external: The external diff generator exited: cmd=cd "/var/folders/d2/_571cg_x0qggrx55nv1b8kjh0000gq/T/jj-diff-PU1QXi" && "/usr/local/bin/zed" "--zed" "/usr/local/bin/zed" "--wait" "--new" "--diff" "left" "right" exit_status=ExitStatus(unix_wait_status(256))
Warning: Tool exited with exit status: 1 (run with --debug to see the exact invocation)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants