Skip to content

Commit

Permalink
ls: remove unused arg check_for_deref
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Dec 24, 2023
1 parent 18035a5 commit c5217b3
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3070,7 +3070,7 @@ fn display_item_name(
}

if let Some(ls_colors) = &config.color {
name = color_name(name, path, ls_colors, style_manager, out, false, None);
name = color_name(name, path, ls_colors, style_manager, out, None);
}

if config.format != Format::Long && !more_info.is_empty() {
Expand Down Expand Up @@ -3151,7 +3151,6 @@ fn display_item_name(
ls_colors,
style_manager,
out,
true,
Some(&target_data),
));
}
Expand Down Expand Up @@ -3272,7 +3271,6 @@ fn color_name(
ls_colors: &LsColors,
style_manager: &mut StyleManager,
out: &mut BufWriter<Stdout>,
check_for_deref: bool,
target_symlink: Option<&PathData>,
) -> String {
if !path.must_dereference {
Expand All @@ -3286,11 +3284,10 @@ fn color_name(
}
}

if check_for_deref {
if let Some(target) = target_symlink {
// use the optional target_symlink
// Use fn get_metadata_with_deref_opt instead of get_metadata() here because ls
// should not exit with an err, if we are unable to obtain the target_metadata
let target = target_symlink.unwrap_or(path);
let md = get_metadata_with_deref_opt(target.p_buf.as_path(), path.must_dereference)
.unwrap_or_else(|_| target.get_metadata(out).unwrap().clone());

Expand Down

0 comments on commit c5217b3

Please sign in to comment.