Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mark .git as ignored, which hides it when using --git-ignore #231

Merged
merged 2 commits into from
Sep 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/fs/feature/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl GitCache {

pub fn get(&self, index: &Path, prefix_lookup: bool) -> f::Git {
self.repos.iter()
.find(|e| e.has_path(index))
.find(|repo| repo.has_path(index))
.map(|repo| repo.search(index, prefix_lookup))
.unwrap_or_default()
}
Expand Down Expand Up @@ -235,6 +235,9 @@ fn repo_to_statuses(repo: &git2::Repository, workdir: &Path) -> Git {
let elem = (path, e.status());
statuses.push(elem);
}
// We manually add the `.git` at the root of the repo as ignored, since it is in practice.
// Also we want to avoid `eza --tree --all --git-ignore` to display files inside `.git`.
statuses.push((workdir.join(".git"), git2::Status::IGNORED));
}
Err(e) => {
error!("Error looking up Git statuses: {:?}", e);
Expand Down