From 2fa6c970a935c06de1ad0e9a958e890cdd38b6fc Mon Sep 17 00:00:00 2001 From: boxbeam Date: Fri, 12 Apr 2024 15:09:55 -0400 Subject: [PATCH] fix(scheduler): Canonicalize git URL in SourceFile rather than tantivy index (#1839) * fix(scheduler): Canonicalize git URL in SourceFile rather than tantivy index * Use canonical_git_url --- crates/tabby-scheduler/src/dataset.rs | 2 +- crates/tabby-scheduler/src/index.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/tabby-scheduler/src/dataset.rs b/crates/tabby-scheduler/src/dataset.rs index 438749dfe5bd..93e5732dc64d 100644 --- a/crates/tabby-scheduler/src/dataset.rs +++ b/crates/tabby-scheduler/src/dataset.rs @@ -61,7 +61,7 @@ impl RepositoryExt for RepositoryConfig { match read_to_string(entry.path()) { Ok(file_content) => { let source_file = SourceFile { - git_url: self.git_url.clone(), + git_url: self.canonical_git_url(), basedir: dir.display().to_string(), filepath: relative_path.display().to_string(), max_line_length: metrics::max_line_length(&file_content), diff --git a/crates/tabby-scheduler/src/index.rs b/crates/tabby-scheduler/src/index.rs index 57975cfacfcc..c184441f679a 100644 --- a/crates/tabby-scheduler/src/index.rs +++ b/crates/tabby-scheduler/src/index.rs @@ -48,7 +48,7 @@ pub fn index_repositories(_config: &[RepositoryConfig]) -> Result<()> { for doc in from_source_file(file) { writer.add_document(doc!( - code.field_git_url => RepositoryConfig::canonicalize_url(&doc.git_url), + code.field_git_url => doc.git_url, code.field_filepath => doc.filepath, code.field_language => doc.language, code.field_name => doc.name,