diff options
author | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 10:55:32 +0800 |
---|---|---|
committer | Sebastian Thiel <sebastian.thiel@icloud.com> | 2020-03-29 10:55:32 +0800 |
commit | 9824585960f09729c5547d60edaea5d97fdb595f (patch) | |
tree | 5c57e738d06cc9fc35d7479fe1ba3e576c918f83 /src | |
parent | 6b90258662810ce740f7f9ad44234e10f3367fc3 (diff) |
cleanup 'quick-hack' done in 2.3.9 - much better now
Diffstat (limited to 'src')
-rw-r--r-- | src/aggregate.rs | 9 | ||||
-rw-r--r-- | src/main.rs | 8 | ||||
-rw-r--r-- | src/traverse.rs | 9 |
3 files changed, 8 insertions, 18 deletions
diff --git a/src/aggregate.rs b/src/aggregate.rs index 538950a..b04fa83 100644 --- a/src/aggregate.rs +++ b/src/aggregate.rs @@ -23,16 +23,7 @@ pub fn aggregate( let mut aggregates = Vec::new(); let mut inodes = InodeFilter::default(); let paths: Vec<_> = paths.into_iter().collect(); - let input_len = paths.len(); for path in paths.into_iter() { - // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow - if input_len > 1 { - if let Ok(meta) = path.as_ref().symlink_metadata() { - if meta.file_type().is_symlink() { - continue; - } - } - } num_roots += 1; let mut num_bytes = 0u64; let mut num_errors = 0u64; diff --git a/src/main.rs b/src/main.rs index cfe6228..91cb79b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -102,6 +102,14 @@ fn cwd_dirlist() -> Result<Vec<PathBuf>, io::Error> { e.ok() .and_then(|e| e.path().strip_prefix(".").ok().map(ToOwned::to_owned)) }) + .filter(|p| { + if let Ok(meta) = p.symlink_metadata() { + if meta.file_type().is_symlink() { + return false; + } + }; + true + }) .collect(); v.sort(); Ok(v) diff --git a/src/traverse.rs b/src/traverse.rs index c971bd1..ab4eff9 100644 --- a/src/traverse.rs +++ b/src/traverse.rs @@ -78,16 +78,7 @@ impl Traversal { // Also means that we will spin up a bunch of threads per root path, instead of reusing them. walk_options.threads = num_cpus::get(); } - let input_len = input.len(); for path in input.into_iter() { - // For now, bluntly ignore symlinks that are on the top-level, and there are more roots to follow - if input_len > 1 { - if let Ok(meta) = path.symlink_metadata() { - if meta.file_type().is_symlink() { - continue; - } - } - } let mut last_seen_eid = 0; for (eid, entry) in walk_options .iter_from_path(path.as_ref()) |