Skip to content

Commit 9267510

Browse files
authored
Merge pull request #16 from Kobzol/allow-noop
Add a flag to exit with status code 0 if there is nothing to pull
2 parents 57c3649 + a5272a0 commit 9267510

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/bin/rustc_josh_sync.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ enum Command {
4141
/// By default, josh-sync will pull from rustc's HEAD (latest commit).
4242
#[clap(long)]
4343
upstream_commit: Option<String>,
44+
45+
/// By default, the `pull` command will exit with status code 2 if there is nothing to pull.
46+
/// If you instead want to exit successfully in that case, pass this flag.
47+
#[clap(long)]
48+
allow_noop: bool,
4449
},
4550
/// Push changes into the main `rust-lang/rust` repository `branch` of a `rustc` fork under
4651
/// the given GitHub `username`.
@@ -90,6 +95,7 @@ fn main() -> anyhow::Result<()> {
9095
rust_version_path,
9196
upstream_repo,
9297
upstream_commit,
98+
allow_noop,
9399
} => {
94100
let ctx = load_context(&config_path, &rust_version_path)?;
95101
let josh = get_josh_proxy()?;
@@ -109,7 +115,9 @@ fn main() -> anyhow::Result<()> {
109115
}
110116
Err(RustcPullError::NothingToPull) => {
111117
eprintln!("Nothing to pull");
112-
std::process::exit(2);
118+
if !allow_noop {
119+
std::process::exit(2);
120+
}
113121
}
114122
Err(RustcPullError::PullFailed(error)) => {
115123
eprintln!("Pull failure: {error:?}");

0 commit comments

Comments
 (0)