fn delete_case_conflict_refs()

in focus/operations/src/refs.rs [147:167]


fn delete_case_conflict_refs(repo: &Repository, names: Vec<String>) -> Result<Vec<String>> {
    debug!("cleaning up case conflict ref names");

    let mut lower_set: HashSet<String> = HashSet::new();

    let mut ok_names: Vec<String> = Vec::new();

    for name in names {
        if !lower_set.insert(name.to_lowercase()) {
            debug!("deleting case conflict ref name: {}", name);
            // this is a conflict so delete this ref here so we don't run into
            // a problem when we do the bulk deletion
            let mut rf = repo.find_reference(&name).context("find conflicting ref")?;
            rf.delete().context("delete conflicting ref")?;
        } else {
            ok_names.push(name);
        }
    }

    Ok(ok_names)
}