mirror of
https://github.com/Llewellynvdm/exa.git
synced 2025-01-23 05:48:25 +00:00
Only display Git column for directories with repos
This fixes the previous commit.
This commit is contained in:
parent
558b13880b
commit
9cda05df20
@ -23,7 +23,7 @@ pub struct GitCache {
|
||||
|
||||
impl GitCache {
|
||||
pub fn has_anything_for(&self, index: &Path) -> bool {
|
||||
true
|
||||
self.repos.iter().any(|e| e.has_path(index))
|
||||
}
|
||||
|
||||
pub fn get(&self, index: &Path, prefix_lookup: bool) -> f::Git {
|
||||
|
@ -144,7 +144,8 @@ impl<'a> Render<'a> {
|
||||
let mut rows = Vec::new();
|
||||
|
||||
if let Some(ref table) = self.opts.table {
|
||||
if self.dir.is_none() { git = None }
|
||||
if self.dir.is_none() { git = None }
|
||||
if let (Some(g), Some(d)) = (git, self.dir) { if !g.has_anything_for(&d.path) { git = None } }
|
||||
let mut table = Table::new(&table, git, &self.colours);
|
||||
|
||||
if self.opts.header {
|
||||
|
@ -169,6 +169,7 @@ impl<'a> Render<'a> {
|
||||
|
||||
fn make_table<'t>(&'a self, options: &'a TableOptions, mut git: Option<&'a GitCache>, drender: &DetailsRender) -> (Table<'a>, Vec<DetailsRow>) {
|
||||
if self.dir.is_none() { git = None }
|
||||
if let (Some(g), Some(d)) = (git, self.dir) { if !g.has_anything_for(&d.path) { git = None } }
|
||||
let mut table = Table::new(options, git, self.colours);
|
||||
let mut rows = Vec::new();
|
||||
|
||||
|
@ -213,7 +213,8 @@ $exa $testcases/git/additions $testcases/git2/deeply \
|
||||
$exa $testcases/git2/deeply/nested/directory $testcases/git/edits \
|
||||
$testcases/git2/target $testcases/git2/deeply $testcases/git --git --long | diff -q - $results/git_21221 || exit 1
|
||||
|
||||
|
||||
$exa $testcases/files -l --git | diff -q - $results/files_l || exit 1 # no git status for dirs
|
||||
COLUMNS=40 $exa $testcases/files -lG --git | diff -q - $results/files_lG_40 || exit 1 # that aren't under git
|
||||
|
||||
|
||||
# Hidden files
|
||||
|
Loading…
x
Reference in New Issue
Block a user