diff --git a/Cargo.lock b/Cargo.lock index 76603651ab26..c2ec39a2ff4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -185,19 +185,6 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9b34d609dfbaf33d6889b2b7106d3ca345eacad44200913df5ba02bfd31d2ba9" -[[package]] -name = "async-channel" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f28243a43d821d11341ab73c80bed182dc015c514b951616cf79bd4af39af0c3" -dependencies = [ - "concurrent-queue", - "event-listener 5.2.0", - "event-listener-strategy 0.5.0", - "futures-core", - "pin-project-lite", -] - [[package]] name = "async-convert" version = "1.0.0" @@ -207,28 +194,6 @@ dependencies = [ "async-trait", ] -[[package]] -name = "async-fs" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc19683171f287921f2405677dd2ed2549c3b3bda697a563ebc3a121ace2aba1" -dependencies = [ - "async-lock", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-lock" -version = "3.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" -dependencies = [ - "event-listener 4.0.3", - "event-listener-strategy 0.4.0", - "pin-project-lite", -] - [[package]] name = "async-openai" version = "0.18.3" @@ -276,12 +241,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "async-task" -version = "4.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" - [[package]] name = "async-trait" version = "0.1.74" @@ -293,16 +252,6 @@ dependencies = [ "syn 2.0.52", ] -[[package]] -name = "async-walkdir" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73f6338023cbfc0555eccb8e83d3d4dcf1183b51ca9140a03b1dbb8a559193db" -dependencies = [ - "async-fs", - "futures-lite", -] - [[package]] name = "atoi" version = "2.0.0" @@ -312,12 +261,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - [[package]] name = "atomic-write-file" version = "0.1.2" @@ -530,22 +473,6 @@ dependencies = [ "generic-array", ] -[[package]] -name = "blocking" -version = "1.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "fastrand 2.0.1", - "futures-io", - "futures-lite", - "piper", - "tracing", -] - [[package]] name = "bson" version = "1.2.4" @@ -729,15 +656,6 @@ dependencies = [ "unreachable", ] -[[package]] -name = "concurrent-queue" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "console" version = "0.15.7" @@ -1211,48 +1129,6 @@ version = "2.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" -[[package]] -name = "event-listener" -version = "4.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b5fb89194fa3cad959b833185b3063ba881dbfc7030680b314250779fb4cc91" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" -dependencies = [ - "event-listener 4.0.3", - "pin-project-lite", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "feedafcaa9b749175d5ac357452a9d41ea2911da598fde46ce1fe02c37751291" -dependencies = [ - "event-listener 5.2.0", - "pin-project-lite", -] - [[package]] name = "eventsource-stream" version = "0.2.3" @@ -1447,19 +1323,6 @@ version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" -[[package]] -name = "futures-lite" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" -dependencies = [ - "fastrand 2.0.1", - "futures-core", - "futures-io", - "parking", - "pin-project-lite", -] - [[package]] name = "futures-macro" version = "0.3.29" @@ -2939,12 +2802,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "parking" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" - [[package]] name = "parking_lot" version = "0.12.1" @@ -3097,17 +2954,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" -[[package]] -name = "piper" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" -dependencies = [ - "atomic-waker", - "fastrand 2.0.1", - "futures-io", -] - [[package]] name = "pkcs1" version = "0.7.5" @@ -4239,7 +4085,7 @@ dependencies = [ "crossbeam-queue", "dotenvy", "either", - "event-listener 2.5.3", + "event-listener", "futures-channel", "futures-core", "futures-intrusive", @@ -4731,7 +4577,6 @@ dependencies = [ "argon2", "assert_matches", "async-trait", - "async-walkdir", "axum", "base64 0.22.0", "bincode", @@ -4739,6 +4584,7 @@ dependencies = [ "futures", "hash-ids", "hyper", + "ignore", "jsonwebtoken", "juniper", "juniper-axum", diff --git a/Cargo.toml b/Cargo.toml index 7712878600ec..448ddbadc0dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,6 +47,7 @@ chrono = "0.4" reqwest-eventsource = "0.5.0" serial_test = "3.0.0" hash-ids = "0.2.1" +ignore = "0.4.20" [workspace.dependencies.uuid] version = "1.3.3" diff --git a/crates/tabby-scheduler/Cargo.toml b/crates/tabby-scheduler/Cargo.toml index b20ca907369d..7e3fe4334bb3 100644 --- a/crates/tabby-scheduler/Cargo.toml +++ b/crates/tabby-scheduler/Cargo.toml @@ -23,7 +23,7 @@ tree-sitter-c = { git = "https://github.com/tree-sitter/tree-sitter-c/", rev = " tree-sitter-cpp = { git = "https://github.com/tree-sitter/tree-sitter-cpp", rev = "a714740" } tree-sitter-c-sharp = "0.20.0" tree-sitter-solidity = { git = "https://github.com/JoranHonig/tree-sitter-solidity", rev = "b239a95" } -ignore = "0.4.20" +ignore.workspace = true kdam = { version = "0.5.0" } requirements = "0.3.0" serdeconv.workspace = true diff --git a/ee/tabby-webserver/Cargo.toml b/ee/tabby-webserver/Cargo.toml index 9a8a1c328014..90fb02b8fb15 100644 --- a/ee/tabby-webserver/Cargo.toml +++ b/ee/tabby-webserver/Cargo.toml @@ -12,7 +12,6 @@ prod-db = ['tabby-db/prod-db'] anyhow.workspace = true argon2 = "0.5.1" async-trait.workspace = true -async-walkdir = "1.0.0" axum = { workspace = true, features = ["ws", "headers"] } base64 = "0.22.0" bincode = "1.3.3" @@ -47,6 +46,7 @@ url = "2.5.0" urlencoding = "2.1.3" uuid.workspace = true validator = { version = "0.16.1", features = ["derive"] } +ignore.workspace = true [dev-dependencies] assert_matches = "1.5.0" diff --git a/ee/tabby-webserver/src/service/repository.rs b/ee/tabby-webserver/src/service/repository.rs index dea4d1aa3d98..1398e01ba7a6 100644 --- a/ee/tabby-webserver/src/service/repository.rs +++ b/ee/tabby-webserver/src/service/repository.rs @@ -1,7 +1,7 @@ use std::path::Path; use async_trait::async_trait; -use futures::StreamExt; +use ignore::Walk; use juniper::ID; use tabby_common::config::RepositoryConfig; use tabby_db::DbConn; @@ -30,16 +30,17 @@ fn match_glob(path: &str, glob: &str) -> bool { async fn find_glob(base: &Path, glob: &str, limit: usize) -> Result, anyhow::Error> { let mut paths = vec![]; - let mut walk = async_walkdir::WalkDir::new(base); - while let Some(path) = walk.next().await.transpose()? { - let full_path = path.path(); + let walk = Walk::new(base); + for entry in walk { + let entry = entry?; + let full_path = entry.path(); let full_path = full_path.strip_prefix(base)?; let name = full_path.to_string_lossy(); if !match_glob(&name, glob) { continue; } paths.push(FileEntry { - r#type: if path.file_type().await?.is_dir() { + r#type: if entry.file_type().map(|x| x.is_dir()).unwrap_or_default() { "dir".into() } else { "file".into() @@ -50,6 +51,7 @@ async fn find_glob(base: &Path, glob: &str, limit: usize) -> Result Result { - Ok((self as &DbConn) - .create_repository(name, git_url) - .await? - .as_id()) + Ok(self.create_repository(name, git_url).await?.as_id()) } async fn delete_repository(&self, id: &ID) -> Result { - Ok((self as &DbConn).delete_repository(id.as_rowid()?).await?) + Ok(self.delete_repository(id.as_rowid()? as i64).await?) } async fn update_repository(&self, id: &ID, name: String, git_url: String) -> Result { - (self as &DbConn) - .update_repository(id.as_rowid()?, name, git_url) - .await?; + self.update_repository(id.as_rowid()? as i64, name, git_url).await?; Ok(true) }