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.
This commit is contained in:
Alexis Sellier 2023-05-15 13:09:25 +02:00
parent a1674600e9
commit c267ff71f1
No known key found for this signature in database
1 changed files with 5 additions and 0 deletions

View File

@ -330,6 +330,11 @@ fn patch_update<G: Signer>(
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())?;