ok/jj
1
0
Fork 0
forked from mirrors/jj

merge_tools: make dirs readonly for external difftool

As far as I understand, the difftool is supposed to be readonly,
so let's encourage people to no edit the files being diffed.
This commit is contained in:
Ilya Grigoriev 2023-08-07 16:11:02 -07:00
parent cc335a9970
commit 9e08b52d55

View file

@ -438,6 +438,10 @@ pub fn generate_diff(
) -> Result<(), DiffGenerateError> { ) -> Result<(), DiffGenerateError> {
let store = left_tree.store(); let store = left_tree.store();
let diff_wc = check_out_trees(store, left_tree, right_tree, matcher)?; let diff_wc = check_out_trees(store, left_tree, right_tree, matcher)?;
set_readonly_recursively(diff_wc.left_working_copy_path())
.map_err(ExternalToolError::SetUpDir)?;
set_readonly_recursively(diff_wc.right_working_copy_path())
.map_err(ExternalToolError::SetUpDir)?;
// TODO: Add support for tools without directory diff functionality? // TODO: Add support for tools without directory diff functionality?
// TODO: Somehow propagate --color to the external command? // TODO: Somehow propagate --color to the external command?
let patterns = diff_wc.to_command_variables(); let patterns = diff_wc.to_command_variables();