Skip to content

Conversation

@evmar
Copy link

@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
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
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

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