From 51496de9fb1ef370aa19101f997372ca8df7a7f7 Mon Sep 17 00:00:00 2001 From: Yuya Nishihara Date: Thu, 29 Feb 2024 17:52:18 +0900 Subject: [PATCH] merge_tools: don't enable fsmonitor (and file size limit) in temporary snapshot Because the snapshot directory is removed at the end of the function, it doesn't make sense to enable watchman in it. The max_new_file_size parameter might be somewhat useful, but it's unlikely that the temporary directory contains gigantic node_modules tree for example. OTOH, the base_ignores matters since it may contain common ignore patterns like *~. This eliminates most of the UserSettings dependencies from this function. --- cli/src/merge_tools/external.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/src/merge_tools/external.rs b/cli/src/merge_tools/external.rs index af588a1da..f9c59e2b0 100644 --- a/cli/src/merge_tools/external.rs +++ b/cli/src/merge_tools/external.rs @@ -10,6 +10,7 @@ use futures::StreamExt; use itertools::Itertools; use jj_lib::backend::{FileId, MergedTreeId, TreeValue}; use jj_lib::conflicts::{self, materialize_merge_result}; +use jj_lib::fsmonitor::FsmonitorKind; use jj_lib::gitignore::GitIgnoreFile; use jj_lib::local_working_copy::{TreeState, TreeStateError}; use jj_lib::matchers::Matcher; @@ -516,14 +517,15 @@ diff editing in mind and be a little inaccurate. std::fs::remove_file(instructions_path_to_cleanup).ok(); } + // Snapshot changes in the temporary output directory. let mut output_tree_state = diff_wc .output_tree_state .unwrap_or(diff_wc.right_tree_state); output_tree_state.snapshot(SnapshotOptions { base_ignores, - fsmonitor_kind: settings.fsmonitor_kind()?, + fsmonitor_kind: FsmonitorKind::None, progress: None, - max_new_file_size: settings.max_new_file_size()?, + max_new_file_size: u64::MAX, })?; Ok(output_tree_state.current_tree_id().clone()) }