Skip to content

Commit

Permalink
fix(repository): fix garbage collection, add missing repositories in …
Browse files Browse the repository at this point in the history
…config.toml (#3721)

* feat(repository): extend repository list with configured repositories

* [autofix.ci] apply automated fixes

* refactor(repository): add comments to clarify repository listing logic

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
wsxiaoys and autofix-ci[bot] authored Jan 18, 2025
1 parent 6129191 commit 9a3300a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ee/tabby-webserver/src/service/repository/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ pub fn create(
#[async_trait]
impl RepositoryService for RepositoryServiceImpl {
async fn list_all_code_repository(&self) -> Result<Vec<CodeRepository>> {
// Read repositories configured as git url.
let mut repos: Vec<CodeRepository> = self
.git
.list(None, None, None, None)
Expand All @@ -52,13 +53,25 @@ impl RepositoryService for RepositoryServiceImpl {
.map(|repo| CodeRepository::new(&repo.git_url, &repo.source_id()))
.collect();

// Read repositories configured as third party integration (e.g Github, Gitlab)
repos.extend(
self.third_party
.list_code_repositories()
.await
.unwrap_or_default(),
);

// Read repositories configured in `config.toml`
repos.extend(
self.config
.iter()
.enumerate()
.map(|(index, repo)| {
CodeRepository::new(repo.git_url(), &config_index_to_id(index))
})
.collect::<Vec<CodeRepository>>(),
);

Ok(repos)
}

Expand Down

0 comments on commit 9a3300a

Please sign in to comment.