Radish alpha
h
rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5
Radicle Heartwood Protocol & Stack
Radicle
Git
helper: Fix error message
Merged did:key:z6MktaNv...ZRZW opened 2 years ago

Git was outputting a confusing message when an unuspported option was used:

fatal: helper rad does not support ‘push-option’

This fixes it.

2 files changed +12 -5 786ce40f 1c4a2cd1
modified 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"
+
```
modified 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 <msg>` 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");