From a3864a32807d8665540f035007ce1826b4632e60 Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Wed, 10 Jul 2024 23:38:16 +0900 Subject: [PATCH] fix(core): canonicalize git_url before performing code search (#2612) * fix(core): canonicalize git_url before performing code search Previously, the git_url used in the index was not properly canonicalized, leading to inconsistencies when performing queries. This commit updates the code to ensure that the git_url is canonicalized before performing the code search. * [autofix.ci] apply automated fixes --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- .../unreleased/Fixed and Improvements-20240710-185920.yaml | 3 +++ crates/tabby/src/services/code.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Fixed and Improvements-20240710-185920.yaml diff --git a/.changes/unreleased/Fixed and Improvements-20240710-185920.yaml b/.changes/unreleased/Fixed and Improvements-20240710-185920.yaml new file mode 100644 index 000000000..da4d79f98 --- /dev/null +++ b/.changes/unreleased/Fixed and Improvements-20240710-185920.yaml @@ -0,0 +1,3 @@ +kind: Fixed and Improvements +body: Canonicalize the git_url before performing a relevant code search. Previously, for git_urls with credentials, the canonicalized git_url was used in the index, but the query still used the raw git_url. +time: 2024-07-10T18:59:20.774068+09:00 diff --git a/crates/tabby/src/services/code.rs b/crates/tabby/src/services/code.rs index b19196fbe..ff52c2e19 100644 --- a/crates/tabby/src/services/code.rs +++ b/crates/tabby/src/services/code.rs @@ -84,7 +84,7 @@ impl CodeSearchImpl { query.git_url, git_url ); - query.git_url = git_url.to_owned(); + query.git_url = RepositoryConfig::canonicalize_url(git_url); let docs_from_embedding = { let embedding = self.embedding.embed(&query.content).await?;