diff --git a/radicle-cli/examples/git/git-push.md b/radicle-cli/examples/git/git-push.md index c7762dcb..d216d7a9 100644 --- a/radicle-cli/examples/git/git-push.md +++ b/radicle-cli/examples/git/git-push.md @@ -69,3 +69,9 @@ $ git push rad :master error: refusing to delete default branch ref 'refs/heads/master' error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi' ``` + +If you pass an unsupported push option, you get an error: +``` (stderr) (fail) +$ git push -o alien rad HEAD:alice/2 +error: unknown push option "alien" +``` diff --git a/radicle-remote-helper/src/lib.rs b/radicle-remote-helper/src/lib.rs index 7ada7d44..47644d76 100644 --- a/radicle-remote-helper/src/lib.rs +++ b/radicle-remote-helper/src/lib.rs @@ -146,11 +146,12 @@ pub fn run(profile: radicle::Profile) -> Result<(), Error> { println!("ok"); } ["option", "push-option", args @ ..] => { - if push_option(args, &mut opts).is_ok() { - println!("ok"); - } else { - println!("unsupported"); - } + // Nb. Git documentation says that we can print `error ` or `unsupported` + // for options that are not supported, but this results in Git saying that + // "push-option" itself is an unsupported option, which is not helpful or correct. + // Hence, we just exit with an error in this case. + push_option(args, &mut opts)?; + println!("ok"); } ["option", "progress", ..] => { println!("unsupported");