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.
This commit is contained in:
Yuya Nishihara 2024-02-29 17:52:18 +09:00
parent 2a3b0eeaec
commit 51496de9fb

View file

@ -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())
}