From a5272a0681cbaa79d3b2945f94976cf4a698a8b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Wed, 23 Jul 2025 09:32:38 +0200 Subject: [PATCH] Add a flag to exit with status code 0 if there is nothing to pull --- src/bin/rustc_josh_sync.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/bin/rustc_josh_sync.rs b/src/bin/rustc_josh_sync.rs index 6ba7b99..8eca920 100644 --- a/src/bin/rustc_josh_sync.rs +++ b/src/bin/rustc_josh_sync.rs @@ -41,6 +41,11 @@ enum Command { /// By default, josh-sync will pull from rustc's HEAD (latest commit). #[clap(long)] upstream_commit: Option, + + /// By default, the `pull` command will exit with status code 2 if there is nothing to pull. + /// If you instead want to exit successfully in that case, pass this flag. + #[clap(long)] + allow_noop: bool, }, /// Push changes into the main `rust-lang/rust` repository `branch` of a `rustc` fork under /// the given GitHub `username`. @@ -90,6 +95,7 @@ fn main() -> anyhow::Result<()> { rust_version_path, upstream_repo, upstream_commit, + allow_noop, } => { let ctx = load_context(&config_path, &rust_version_path)?; let josh = get_josh_proxy()?; @@ -109,7 +115,9 @@ fn main() -> anyhow::Result<()> { } Err(RustcPullError::NothingToPull) => { eprintln!("Nothing to pull"); - std::process::exit(2); + if !allow_noop { + std::process::exit(2); + } } Err(RustcPullError::PullFailed(error)) => { eprintln!("Pull failure: {error:?}");