remove git2 dependency for repository cloning in semantic_index eval
This commit is contained in:
parent
b57b5c0b33
commit
25cb79e475
4 changed files with 14 additions and 35 deletions
19
Cargo.lock
generated
19
Cargo.lock
generated
|
@ -3059,8 +3059,6 @@ dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"libgit2-sys",
|
"libgit2-sys",
|
||||||
"log",
|
"log",
|
||||||
"openssl-probe",
|
|
||||||
"openssl-sys",
|
|
||||||
"url",
|
"url",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4023,9 +4021,7 @@ checksum = "7f3d95f6b51075fe9810a7ae22c7095f12b98005ab364d8544797a825ce946a4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
"libssh2-sys",
|
|
||||||
"libz-sys",
|
"libz-sys",
|
||||||
"openssl-sys",
|
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -4066,20 +4062,6 @@ dependencies = [
|
||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libssh2-sys"
|
|
||||||
version = "0.2.23"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"libz-sys",
|
|
||||||
"openssl-sys",
|
|
||||||
"pkg-config",
|
|
||||||
"vcpkg",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.1.12"
|
version = "1.1.12"
|
||||||
|
@ -6756,7 +6738,6 @@ dependencies = [
|
||||||
"editor",
|
"editor",
|
||||||
"env_logger 0.9.3",
|
"env_logger 0.9.3",
|
||||||
"futures 0.3.28",
|
"futures 0.3.28",
|
||||||
"git2",
|
|
||||||
"globset",
|
"globset",
|
||||||
"gpui",
|
"gpui",
|
||||||
"isahc",
|
"isahc",
|
||||||
|
|
|
@ -116,7 +116,7 @@ toml = { version = "0.5" }
|
||||||
tree-sitter = "0.20"
|
tree-sitter = "0.20"
|
||||||
unindent = { version = "0.1.7" }
|
unindent = { version = "0.1.7" }
|
||||||
pretty_assertions = "1.3.0"
|
pretty_assertions = "1.3.0"
|
||||||
git2 = { version = "0.15" }
|
git2 = { version = "0.15", default-features = false}
|
||||||
|
|
||||||
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "1b0321ee85701d5036c334a6f04761cdc672e64c" }
|
tree-sitter-bash = { git = "https://github.com/tree-sitter/tree-sitter-bash", rev = "1b0321ee85701d5036c334a6f04761cdc672e64c" }
|
||||||
tree-sitter-c = "0.20.1"
|
tree-sitter-c = "0.20.1"
|
||||||
|
|
|
@ -55,7 +55,6 @@ rust-embed = { version = "8.0", features = ["include-exclude"] }
|
||||||
client = { path = "../client" }
|
client = { path = "../client" }
|
||||||
zed = { path = "../zed"}
|
zed = { path = "../zed"}
|
||||||
node_runtime = { path = "../node_runtime"}
|
node_runtime = { path = "../node_runtime"}
|
||||||
git2.workspace = true
|
|
||||||
|
|
||||||
pretty_assertions.workspace = true
|
pretty_assertions.workspace = true
|
||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use anyhow::{anyhow, Result};
|
use anyhow::{anyhow, Result};
|
||||||
use client::{self, UserStore};
|
use client::{self, UserStore};
|
||||||
use git2::{Object, Oid, Repository};
|
|
||||||
use gpui::{AsyncAppContext, ModelHandle, Task};
|
use gpui::{AsyncAppContext, ModelHandle, Task};
|
||||||
use language::LanguageRegistry;
|
use language::LanguageRegistry;
|
||||||
use node_runtime::RealNodeRuntime;
|
use node_runtime::RealNodeRuntime;
|
||||||
|
@ -11,6 +10,7 @@ use semantic_index::{SearchResult, SemanticIndex};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use settings::{default_settings, handle_settings_file_changes, watch_config_file, SettingsStore};
|
use settings::{default_settings, handle_settings_file_changes, watch_config_file, SettingsStore};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
use std::process::Command;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::time::{Duration, Instant};
|
use std::time::{Duration, Instant};
|
||||||
use std::{cmp, env, fs};
|
use std::{cmp, env, fs};
|
||||||
|
@ -95,23 +95,22 @@ fn clone_repo(repo_eval: RepoEval) -> anyhow::Result<(String, PathBuf)> {
|
||||||
.ok_or(anyhow!("path canonicalization failed"))?
|
.ok_or(anyhow!("path canonicalization failed"))?
|
||||||
.parent()
|
.parent()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.join(TMP_REPO_PATH)
|
.join(TMP_REPO_PATH);
|
||||||
.join(&repo_name);
|
|
||||||
|
|
||||||
// Delete Clone Path if already exists
|
// Delete Clone Path if already exists
|
||||||
let _ = fs::remove_dir_all(&clone_path);
|
let _ = fs::remove_dir_all(&clone_path);
|
||||||
|
let _ = fs::create_dir(&clone_path);
|
||||||
|
|
||||||
// Clone in Repo
|
let _ = Command::new("git")
|
||||||
git2::build::RepoBuilder::new()
|
.args(["clone", repo_eval.repo.as_str()])
|
||||||
// .branch(repo_eval.sha.as_str())
|
.current_dir(clone_path.clone())
|
||||||
.clone(repo_eval.repo.as_str(), clone_path.as_path())?;
|
.output()?;
|
||||||
|
// Update clone path to be new directory housing the repo.
|
||||||
let repo: Repository = Repository::open(clone_path.clone())?;
|
let clone_path = clone_path.join(repo_name.clone());
|
||||||
let obj: Object = repo
|
let _ = Command::new("git")
|
||||||
.find_commit(Oid::from_str(repo_eval.commit.as_str())?)?
|
.args(["checkout", repo_eval.commit.as_str()])
|
||||||
.into_object();
|
.current_dir(clone_path.clone())
|
||||||
repo.checkout_tree(&obj, None)?;
|
.output()?;
|
||||||
repo.set_head_detached(obj.id())?;
|
|
||||||
|
|
||||||
Ok((repo_name, clone_path))
|
Ok((repo_name, clone_path))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue