Skip to content

Recommend file-by-file mode for Jujutsu config#864

Closed
evmar wants to merge 1 commit into
Wilfred:masterfrom
evmar:patch-1
Closed

Recommend file-by-file mode for Jujutsu config#864
evmar wants to merge 1 commit into
Wilfred:masterfrom
evmar:patch-1

Conversation

@evmar
Copy link
Copy Markdown

@evmar evmar commented Jul 25, 2025

The previous docs gave difft two directories to diff. But that loses information about file renames, which is information jj has.

This configuration tells Jujutsu to pass individual pairs of files to difft.

The previous docs gave difft two directories to diff.  But that
loses information about file renames, which is information jj has.

This configuration tells Jujutsu to pass individual pairs of files
to difft.
@evmar
Copy link
Copy Markdown
Author

evmar commented Jul 25, 2025

I had been using this config for a while but hadn't thought to tell you about it, because the paths in the output looked bad. But after a jj update (I think?) my diffs have good paths in them, so I think it's 100% positive now.

But you should probably figure out if #863 is a problem before accepting this.

@evmar
Copy link
Copy Markdown
Author

evmar commented Jul 25, 2025

Create a file rename repo:

~/test$ jj version
jj 0.30.0
~/test$ jj git init --colocate
Initialized repo in "."
~/test$ echo hello > hello.txt
~/test$ jj file track hello.txt
~/test$ jj new
Working copy  (@) now at: wlszowpk (empty) (no description set)
Parent commit (@-)      : qlzwntuv (no description set)
~/test$ mv hello.txt hello2.txt
~/test$ jj file track hello2.txt

With this config:

~/test$ jj diff
right/hello2.txt --- Text
No changes.

~/test$ jj --debug diff
2025-07-25T18:14:29.904959Z  INFO jj_cli::cli_util: debug logging enabled
2025-07-25T18:14:29.909027Z  INFO run_command:cmd_diff:request_pager: jj_cli::ui: spawning pager cmd=LESSCHARSET="utf-8" "less" "-FRX"
2025-07-25T18:14:29.910651Z  INFO run_command:cmd_diff: jj_cli::merge_tools::external: Invoking the external diff generator: cmd=cd "/var/folders/lv/q0zqfs9520n6pvkk9lkz62500000gn/T/jj-diff-srWiPO" && "difft" "--color=always" "left/hello.txt" "right/hello2.txt"
right/hello2.txt --- Text
No changes.

2025-07-25T18:14:29.914385Z  INFO run_command:cmd_diff: jj_cli::merge_tools::external: The external diff generator exited: cmd=cd "/var/folders/lv/q0zqfs9520n6pvkk9lkz62500000gn/T/jj-diff-srWiPO" && "difft" "--color=always" "left/hello.txt" "right/hello2.txt" exit_status=ExitStatus(unix_wait_status(0))

Comparison to built-in output:

~/test$ jj diff --git
diff --git a/hello.txt b/hello2.txt
rename from hello.txt
rename to hello2.txt

With a rename + edit:

~/test$ echo world >> hello2.txt
~/test$ jj diff
right/hello2.txt --- Text
1 1 hello
. 2 world

@evmar
Copy link
Copy Markdown
Author

evmar commented May 8, 2026

It took me almost a year, but I dug into this a bit more on jj-vcs/jj#7660 . I think until that is resolved we shouldn't make a change here, so when we do make a change we can change both this and the jj docs (https://docs.jj-vcs.dev/latest/config/#generating-diffs-by-external-command) to the final correct version.

It's unfortunate that right now both docs have a config where file renames aren't right, but I guess nobody else minds as much as me, ha!

@evmar evmar closed this May 8, 2026
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.

1 participant