Skip to content
Merged
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
7 changes: 6 additions & 1 deletion src/commands/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::{Application, RUSTIC_APP, status_err};

use abscissa_core::{Command, Runnable, Shutdown};

use anyhow::Result;
use anyhow::{Result, bail};

use rustic_core::ConfigOptions;

Expand All @@ -29,6 +29,11 @@ impl ConfigCmd {
fn inner_run(&self) -> Result<()> {
let config = RUSTIC_APP.config();

// Handle dry-run mode
if config.global.dry_run {
bail!("cannot modify config in dry-run mode!",);
}

let changed = config
.repository
.run_open(|mut repo| Ok(repo.apply_config(&self.config_opts)?))?;
Expand Down
7 changes: 6 additions & 1 deletion src/commands/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ impl MergeCmd {
repo.get_snapshots(&self.ids)?
};

let snap = SnapshotFile::from_options(&self.snap_opts)?;
// Handle dry-run mode
if config.global.dry_run {
println!("would have modified the following snapshots:\n {snapshots:?}");
return Ok(());
}

let snap = SnapshotFile::from_options(&self.snap_opts)?;
let snap = repo.merge_snapshots(&snapshots, &last_modified_node, snap)?;

if self.json {
Expand Down