a73x

edab1411

Remove let mut p = p rebinding in merge()

a73x   2026-03-21 19:11

Move mut to the original PatchState binding to avoid the awkward rebinding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

diff --git a/src/patch.rs b/src/patch.rs
index 0256319..2ed819b 100644
--- a/src/patch.rs
+++ b/src/patch.rs
@@ -362,7 +362,7 @@ pub fn revise(
pub fn merge(repo: &Repository, id_prefix: &str) -> Result<PatchState, crate::error::Error> {
    let sk = signing::load_signing_key(&signing::signing_key_dir()?)?;
    let (ref_name, id) = state::resolve_patch_ref(repo, id_prefix)?;
    let p = PatchState::from_ref(repo, &ref_name, &id)?;
    let mut p = PatchState::from_ref(repo, &ref_name, &id)?;

    if p.status != PatchStatus::Open {
        return Err(git2::Error::from_str(&format!(
@@ -373,7 +373,6 @@ pub fn merge(repo: &Repository, id_prefix: &str) -> Result<PatchState, crate::er
    }

    // Auto-detect revision before merge
    let mut p = p;
    auto_detect_and_update(repo, &ref_name, &mut p, &sk)?;

    // Check merge policy