Skip to content

Commit

Permalink
fix: do not print parent filename with --absolute=on
Browse files Browse the repository at this point in the history
The parent path of a file was added even with absolute={on,follow}, causing the parent path being prepended to the resolved (absolute) filepath.

Fixes: #1151
  • Loading branch information
libklein authored and cafkafk committed Oct 9, 2024
1 parent feda329 commit db412c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/output/file_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ impl<'a, 'dir, C: Colours> FileName<'a, 'dir, C> {
bits.push(style.paint(" ".repeat(spaces_count as usize)));
}

if self.file.parent_dir.is_none() {
if self.file.parent_dir.is_none() && self.options.absolute == Absolute::Off {
if let Some(parent) = self.file.path.parent() {
self.add_parent_bits(&mut bits, parent);
}
Expand Down
Empty file.
1 change: 1 addition & 0 deletions tests/cmd/absolute_file_all.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[CWD]/tests/itest/index.svg
2 changes: 2 additions & 0 deletions tests/cmd/absolute_file_all.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bin.name = "eza"
args = "tests/itest/index.svg --absolute"

0 comments on commit db412c7

Please sign in to comment.