consolidate shared helpers into utils crate

This commit is contained in:
2026-10-03 11:00:59 +07:00
parent 24070cc2cd
commit d00ee33eab
16 changed files with 89 additions and 177 deletions
+1 -17
View File
@@ -7,6 +7,7 @@ use gpui::{App, AppContext, Context, Entity, Global, Subscription};
use nostr::prelude::*;
use settings::{CheckoutRecord, SettingsStore};
use signed_core::{Announcement, RepoAddr};
use utils::same_repo_url;
use crate::backend::{Backend, BackendEvent};
use crate::git_store::repo_mirror_root;
@@ -511,23 +512,6 @@ impl CheckoutsStore {
}
}
fn url_identity(url: &str) -> Option<(String, Option<u16>, String)> {
let parsed = Url::parse(url).ok()?;
let host = parsed.host_str()?.to_ascii_lowercase();
let mut path = parsed.path().trim_matches('/').to_owned();
if let Some(stripped) = path.strip_suffix(".git") {
path = stripped.to_owned();
}
Some((host, parsed.port(), path))
}
fn same_repo_url(a: &str, b: &str) -> bool {
match (url_identity(a), url_identity(b)) {
(Some(a), Some(b)) => a == b,
_ => a == b,
}
}
fn resolve_associations<'a>(
remembered: &[Remembered],
scanned: &[(PathBuf, Option<String>, Option<String>)],