From c267ff71f1e81077d4f59b47ccc5050a101348ee Mon Sep 17 00:00:00 2001 From: Alexis Sellier Date: Mon, 15 May 2023 13:09:25 +0200 Subject: [PATCH] remote-helper: Don't update patch if up-to-date If the patch has a revision with a matching commit, there's no need to update it again. --- radicle-remote-helper/src/push.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/radicle-remote-helper/src/push.rs b/radicle-remote-helper/src/push.rs index 280ffcd9..41d0d3ed 100644 --- a/radicle-remote-helper/src/push.rs +++ b/radicle-remote-helper/src/push.rs @@ -330,6 +330,11 @@ fn patch_update( let Ok(mut patch) = patches.get_mut(&patch_id) else { return Err(Error::NotFound(patch_id)); }; + + // Don't update patch if it already has a revision matching this commit. + if patch.revisions().any(|(_, r)| *r.head() == commit.id()) { + return Ok(()); + } let message = cli::patch::get_update_message(cli::patch::Message::Edit)?; let (_, target) = stored.canonical_head()?; let base = stored.backend.merge_base(*target, commit.id())?;