Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 113 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ tracing-subscriber = "0.3.19"
tui-textarea = "0.7.0"
tui_confirm_dialog = "0.3.1"
version-compare = "0.2.0"
notify = "8.0.0"

# Release build optimize size.
# Run strip manually after build to reduce further.
Expand Down
16 changes: 16 additions & 0 deletions src/commander/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ pub struct Commander {
env_var: Arc<Mutex<Vec<(String, String)>>>,
pub command_history: Arc<Mutex<Vec<CommandLogItem>>>,

/// When true, add --ignore-working-copy to jj commands.
/// Used during auto-refresh to avoid conflicts with external operations.
ignore_working_copy: bool,

// Used for testing
pub jj_config_toml: Option<Vec<String>>,
pub force_no_color: bool,
Expand All @@ -120,11 +124,18 @@ impl Commander {
env: env.clone(),
env_var: Arc::new(Mutex::new(Vec::new())),
command_history: Arc::new(Mutex::new(Vec::new())),
ignore_working_copy: false,
jj_config_toml: None,
force_no_color: false,
}
}

/// Set whether to use --ignore-working-copy for jj commands.
/// Used during auto-refresh to avoid conflicts with external operations.
pub fn set_ignore_working_copy(&mut self, ignore: bool) {
self.ignore_working_copy = ignore;
}

/// Tell jj to limit the with of output of secondary programs, like diff tools
/// Will ignore too narrow width requests.
/// You should call this before calling a jj command.
Expand Down Expand Up @@ -210,6 +221,11 @@ impl Commander {
command.args(args);
command.args(get_output_args(!self.force_no_color && color, quiet));

// Add --ignore-working-copy if set (used during auto-refresh)
if self.ignore_working_copy {
command.arg("--ignore-working-copy");
}

if let Some(jj_config_toml) = &self.jj_config_toml {
for cfg in jj_config_toml {
command.args(["--config", cfg]);
Expand Down
Loading