Skip to content

Commit

Permalink
Merge pull request #231 from eza-community/ignore-dot-git-when-using-…
Browse files Browse the repository at this point in the history
…git-ignore-flag

feat: mark `.git` as ignored, which hides it when using `--git-ignore`
  • Loading branch information
cafkafk committed Sep 9, 2023
2 parents 96aab43 + 71661e5 commit c2204fc
Showing 1 changed file with 4 additions and 1 deletion.
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

0 comments on commit c2204fc

Please sign in to comment.