Skip to content

Commit

Permalink
update ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
wsxiaoys committed Apr 4, 2024
1 parent a2c5d9f commit 4fe8516
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 171 deletions.
158 changes: 2 additions & 156 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion crates/tabby-scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ee/tabby-webserver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
23 changes: 10 additions & 13 deletions ee/tabby-webserver/src/service/repository.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -30,16 +30,17 @@ fn match_glob(path: &str, glob: &str) -> bool {

async fn find_glob(base: &Path, glob: &str, limit: usize) -> Result<Vec<FileEntry>, 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()

Check warning on line 44 in ee/tabby-webserver/src/service/repository.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/service/repository.rs#L31-L44

Added lines #L31 - L44 were not covered by tests
} else {
"file".into()

Check warning on line 46 in ee/tabby-webserver/src/service/repository.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/service/repository.rs#L46

Added line #L46 was not covered by tests
Expand All @@ -50,6 +51,7 @@ async fn find_glob(base: &Path, glob: &str, limit: usize) -> Result<Vec<FileEntr
break;
}

Check warning on line 52 in ee/tabby-webserver/src/service/repository.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/service/repository.rs#L48-L52

Added lines #L48 - L52 were not covered by tests
}

Ok(paths)
}

Check warning on line 56 in ee/tabby-webserver/src/service/repository.rs

View check run for this annotation

Codecov / codecov/patch

ee/tabby-webserver/src/service/repository.rs#L55-L56

Added lines #L55 - L56 were not covered by tests

Expand All @@ -70,20 +72,15 @@ impl RepositoryService for DbConn {
}

async fn create_repository(&self, name: String, git_url: String) -> Result<ID> {
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<bool> {
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<bool> {
(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)
}

Expand Down

0 comments on commit 4fe8516

Please sign in to comment.