From f9d9bdf8cd07861187cc335a1f5f57ff64316c79 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 19 Dec 2023 16:36:23 +0000 Subject: [PATCH] cli: fix update hint The hint for updating a patch incorrectly printed: git push rad -f HEAD:rad/patches/ The remote, `rad`, is already specified so the the right hand side of the refspec should only be `patches/`. Fix this by stripping the remote from the name of the branch in the remote helper. Signed-off-by: Fintan Halpenny X-Clacks-Overhead: GNU Terry Pratchett --- radicle-cli/examples/rad-patch-via-push.md | 4 ++-- radicle-remote-helper/src/push.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/radicle-cli/examples/rad-patch-via-push.md b/radicle-cli/examples/rad-patch-via-push.md index d4e9d256..7b4038df 100644 --- a/radicle-cli/examples/rad-patch-via-push.md +++ b/radicle-cli/examples/rad-patch-via-push.md @@ -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 diff --git a/radicle-remote-helper/src/push.rs b/radicle-remote-helper/src/push.rs index 189a34b9..d8f6a4a5 100644 --- a/radicle-remote-helper/src/push.rs +++ b/radicle-remote-helper/src/push.rs @@ -394,6 +394,9 @@ fn patch_open( { 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::>().join("/"); eprintln!("hint: to update, run `git push`,"); eprintln!(" or `git push rad -f HEAD:{name}`"); }