Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
helper: Fix error message
Alexis Sellier committed 2 years ago
commit 1c4a2cd1673e91f6a0fc0ee96650446995552b26
parent 786ce40f9563d9ee8d8946708ed39f9b5a70b87f
2 files changed +12 -5
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");