Skip to content

Commit

Permalink
feat: dry-run flag
Browse files Browse the repository at this point in the history
  • Loading branch information
coriolinus committed Jan 23, 2025
1 parent 65e41f5 commit 030a32f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ struct Args {
/// to synchronize itself.
#[arg(short = 'i', long, default_value_t = 2.5)]
push_retry_interval: f64,

/// When set, perform checks but do not actually change the repo state.
#[arg(short, long)]
dry_run: bool,
}

fn ensure_tool(sh: &Shell, tool_name: &str) -> Result<()> {
Expand Down Expand Up @@ -143,6 +147,11 @@ fn main() -> Result<()> {
}
}

if args.dry_run {
println!("all checks OK but aborting due to dry run");
return Ok(());
}

// ensure that the branch is at the tip of its base for a linear history
let base = status.base_ref_name;
cmd!(sh, "git fetch").run().context("git fetch")?;
Expand Down

0 comments on commit 030a32f

Please sign in to comment.