remote-helper: allow patch creation from detached HEAD
The patch creation flow would be partially interrupted when creating a patch via a detached HEAD state. The creation of an upstream branch would fail since there is no branch to set an upstream for. It would result in the following error:
✓ Patch 6035d2f582afbe01ff23ea87528ae523d76875b6 opened
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
! [remote rejected] HEAD -> refs/patches (git: reference 'HEAD' is neither a local nor a remote branch.; class=Invalid (3))
error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi'
To fix this, the reference that’s resolved is checked to see if it a local branch. If not, it will return early.
The behaviour is tested in the rad-patch-detached-head example.
3 files changed
+66
-0
1c46f195
→
dc34eafd
added radicle-cli/examples/rad-patch-detached-head.md
@@ -0,0 +1,41 @@
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
modified radicle-cli/tests/commands.rs
@@ -1045,6 +1045,26 @@ fn rad_patch_via_push() {
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|
modified radicle/src/rad.rs
@@ -353,6 +353,11 @@ pub fn setup_patch_upstream<'a>(
|
|
|
|
|
|
| + | |
| + | |
| + | |
| + | |
| + | |
|
|
|
|
|