remove old approach
This commit is contained in:
parent
3119d0d06e
commit
ed685af557
2 changed files with 2 additions and 38 deletions
|
@ -134,7 +134,6 @@ pub trait Fs: Send + Sync {
|
|||
// fn home_dir(&self) -> Option<PathBuf>;
|
||||
fn open_repo(&self, abs_dot_git: &Path) -> Option<Arc<dyn GitRepository>>;
|
||||
fn git_init(&self, abs_work_directory: &Path, fallback_branch_name: String) -> Result<()>;
|
||||
fn global_git_ignore_path(&self, abs_work_directory: &Path) -> Option<PathBuf>;
|
||||
fn is_fake(&self) -> bool;
|
||||
async fn is_case_sensitive(&self) -> Result<bool>;
|
||||
|
||||
|
@ -822,19 +821,6 @@ impl Fs for RealFs {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
fn global_git_ignore_path(&self, abs_work_directory_path: &Path) -> Option<PathBuf> {
|
||||
new_std_command("git")
|
||||
.current_dir(abs_work_directory_path)
|
||||
.args(&["config", "--get", "core.excludesFile"])
|
||||
.output()
|
||||
.ok()
|
||||
.filter(|output| output.status.success())
|
||||
.and_then(|output| String::from_utf8(output.stdout).ok())
|
||||
.filter(|output| !output.is_empty())
|
||||
.map(PathBuf::from)
|
||||
.or_else(|| Some(dirs::config_dir()?.join("git").join("ignore")))
|
||||
}
|
||||
|
||||
fn is_fake(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
@ -2329,10 +2315,6 @@ impl Fs for FakeFs {
|
|||
smol::block_on(self.create_dir(&abs_work_directory_path.join(".git")))
|
||||
}
|
||||
|
||||
fn global_git_ignore_path(&self, _abs_work_directory: &Path) -> Option<PathBuf> {
|
||||
None
|
||||
}
|
||||
|
||||
fn is_fake(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
|
|
@ -3233,31 +3233,13 @@ async fn is_git_dir(path: &Path, fs: &dyn Fs) -> bool {
|
|||
}
|
||||
|
||||
async fn build_gitignore(abs_path: &Path, fs: &dyn Fs) -> Result<Gitignore> {
|
||||
let contents = fs.load(abs_path).await?;
|
||||
let parent = abs_path.parent().unwrap_or_else(|| Path::new("/"));
|
||||
let mut builder = GitignoreBuilder::new(parent);
|
||||
|
||||
if let Some(path) = fs.global_git_ignore_path(parent) {
|
||||
if let Ok(contents) = fs.load(&path).await {
|
||||
for line in contents.lines() {
|
||||
let _ = builder.add_line(Some(path.clone()), line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let repo_git_exclude_path = parent.join(".git").join("info").join("exclude");
|
||||
if let Ok(contents) = fs.load(&repo_git_exclude_path).await {
|
||||
for line in contents.lines() {
|
||||
let _ = builder.add_line(Some(repo_git_exclude_path.clone()), line);
|
||||
}
|
||||
}
|
||||
|
||||
let contents = fs.load(abs_path).await?;
|
||||
for line in contents.lines() {
|
||||
builder.add_line(Some(abs_path.into()), line)?;
|
||||
}
|
||||
|
||||
let gitignore = builder.build()?;
|
||||
Ok(gitignore)
|
||||
Ok(builder.build()?)
|
||||
}
|
||||
|
||||
impl Deref for Worktree {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue