From 0c70e171238a7b3a56d6c4f275ad79150753f43f Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 25 Nov 2025 09:34:42 +0000 Subject: [PATCH] remote-helper: inform the user of an empty patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous message is included in the error: ! [remote rejected] master -> refs/patches (patch commits are already included in the base branch) To make it clearer to the user, also print a warning to tell them that the commit was in the base branch – including the commit SHA: warn: attempted to create a patch using the commit f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354, but this commit is already included in the base branch --- crates/radicle-cli/examples/rad-patch-via-push.md | 1 + crates/radicle-remote-helper/src/push.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/radicle-cli/examples/rad-patch-via-push.md b/crates/radicle-cli/examples/rad-patch-via-push.md index 7fb298fb..89d43d46 100644 --- a/crates/radicle-cli/examples/rad-patch-via-push.md +++ b/crates/radicle-cli/examples/rad-patch-via-push.md @@ -330,6 +330,7 @@ we should get an error: ``` (stderr) (fail) $ git push rad master:refs/patches +warn: attempted to create a patch using the commit f2de534b5e81d7c6e2dcaf58c3dd91573c0a0354, but this commit is already included in the base branch To rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi ! [remote rejected] master -> refs/patches (patch commits are already included in the base branch) error: failed to push some refs to 'rad://z42hL2jL4XNk6K8oHQaSWfMgCL7ji/z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi' diff --git a/crates/radicle-remote-helper/src/push.rs b/crates/radicle-remote-helper/src/push.rs index a02da395..7de690f2 100644 --- a/crates/radicle-remote-helper/src/push.rs +++ b/crates/radicle-remote-helper/src/push.rs @@ -31,7 +31,7 @@ use radicle::{git, rad}; use radicle_cli as cli; use radicle_cli::terminal as term; -use crate::{hint, read_line, Options, Verbosity}; +use crate::{hint, read_line, warn, Options, Verbosity}; #[derive(Debug, Error)] pub enum Error { @@ -566,6 +566,9 @@ where let base = patch_base(head, &opts, stored)?; if base == *head { + warn(format!( + "attempted to create a patch using the commit {head}, but this commit is already included in the base branch" + )); return Err(Error::EmptyPatch); }