Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
fix: drop non-logging stderr output outside tests
Merged liw opened 1 year ago

Signed-off-by: Lars Wirzenius liw@liw.fi

1 file changed +0 -10 1e1587e8 768b9668
modified src/ci_event.rs
@@ -113,7 +113,6 @@ impl CiEvent {
                for update in updated {
                    let e = match update {
                        RefUpdate::Created { name, oid } => {
-
                            eprintln!("created: {name:?}");
                            if let Ok(patch_id) = patch_id(name) {
                                CiEventV1::PatchCreated {
                                    from_node: *remote,
@@ -129,14 +128,11 @@ impl CiEvent {
                                    tip: *oid,
                                }
                            } else {
-
                                eprintln!("don't know what it is, ignoring");
                                continue;
                            }
                        }
                        RefUpdate::Updated { name, old, new } => {
-
                            eprintln!("updated: {name:?}");
                            if let Ok(patch_id) = patch_id(name) {
-
                                eprintln!("it's a patch");
                                CiEventV1::PatchUpdated {
                                    from_node: *remote,
                                    repo: *rid,
@@ -144,7 +140,6 @@ impl CiEvent {
                                    new_tip: *new,
                                }
                            } else if let Ok(branch) = namespaced_branch(name) {
-
                                eprintln!("it's a branch update");
                                CiEventV1::BranchUpdated {
                                    from_node: *remote,
                                    repo: *rid,
@@ -153,7 +148,6 @@ impl CiEvent {
                                    old_tip: *old,
                                }
                            } else {
-
                                eprintln!("don't know what it is, ignoring");
                                continue;
                            }
                        }
@@ -497,16 +491,12 @@ fn namespaced_branch(refname: &str) -> Result<String, ParseError> {
}

fn patch_id(refname: &str) -> Result<PatchId, ParseError> {
-
    eprintln!("refname: {refname:?}");
    const PAT_PATCH: &str = r"^refs/namespaces/[^/]+/refs/heads/patches/([^/]+)$";
    let patch_re = Regex::new(PAT_PATCH).map_err(|e| ParseError::regex(PAT_PATCH, e))?;
    if let Some(patch_captures) = patch_re.captures(refname) {
-
        eprintln!("captures: {patch_captures:?}");
        if let Some(patch_id) = patch_captures.get(1) {
-
            eprintln!("patch_id: {patch_id:?}");
            let oid = Oid::try_from(patch_id.as_str())
                .map_err(|e| ParseError::oid(patch_id.as_str(), e))?;
-
            eprintln!("oid: {oid:?}");
            return Ok(oid.into());
        }
    }