cli: fix update hint

The hint for updating a patch incorrectly printed:

    git push rad -f HEAD:rad/patches/<patch id>

The remote, `rad`, is already specified so the the right hand side of
the refspec should only be `patches/<patch id>`.

Fix this by stripping the remote from the name of the branch in the
remote helper.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny 2023-12-19 16:36:23 +00:00 committed by cloudhead
parent 9cf6fab7c8
commit f9d9bdf8cd
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View File

@ -10,7 +10,7 @@ $ git commit -a -m "Add things" -q --allow-empty
$ git push -o patch.message="Add things #1" -o patch.message="See commits for details." rad HEAD:refs/patches
✓ Patch 82faae29b2a2f11bf45bbba4c4787d6b32a12447 opened
hint: to update, run `git push`,
or `git push rad -f HEAD:rad/patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447`
or `git push rad -f HEAD:patches/82faae29b2a2f11bf45bbba4c4787d6b32a12447`
hint: offline push, your node is not running
to sync with the network, run `rad node start`
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
@ -112,7 +112,7 @@ $ git commit -a -m "Improve code" -q --allow-empty
```
``` (stderr)
$ git push
$ git push rad
✓ Patch b77b2e8 updated to 8d6692ce2b2219a54d09ccd5feefedb2bae33eba
To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
8b0ea80..02bef3f feature/2 -> patches/b77b2e8a05adcdc859a0184f7db859df1c6686b6

View File

@ -394,6 +394,9 @@ fn patch_open<G: Signer>(
{
if let Some(name) = branch.name()? {
if profile.hints() {
// Remove the remote portion of the name, i.e.
// rad/patches/deadbeef -> patches/deadbeef
let name = name.split('/').skip(1).collect::<Vec<_>>().join("/");
eprintln!("hint: to update, run `git push`,");
eprintln!(" or `git push rad -f HEAD:{name}`");
}