1 Commits

Author SHA1 Message Date
renovate[bot] 647db30e2b Add renovate.json 2023-03-24 09:30:13 +00:00
25 changed files with 377 additions and 824 deletions
+23
View File
@@ -0,0 +1,23 @@
os: Visual Studio 2015
version: "{build}"
environment:
matrix:
- channel: stable
target: x86_64-pc-windows-msvc
- channel: nightly
target: x86_64-pc-windows-msvc
install:
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
- rustup-init -yv --default-toolchain %channel% --default-host %target%
- set PATH=%PATH%;%USERPROFILE%\.cargo\bin
- rustc -vV && cargo -vV
build_script:
- cargo build --verbose
test_script:
- cargo test --verbose
+1 -1
View File
@@ -28,7 +28,7 @@ jobs:
- name: Check
run: |
cargo check --all --all-features
cargo check
test:
name: cargo test
-17
View File
@@ -1,17 +0,0 @@
repos:
- repo: local
hooks:
- id: rust-linting
name: Rust linting
description: Run cargo fmt on files included in the commit.
entry: cargo +nightly fmt --
pass_filenames: true
types: [file, rust]
language: system
- id: rust-clippy
name: Rust clippy
description: Run cargo clippy on files included in the commit.
entry: cargo +nightly clippy --workspace --all-targets --all-features --
pass_filenames: false
types: [file, rust]
language: system
+33
View File
@@ -0,0 +1,33 @@
language: rust
sudo: false
os:
- linux
- osx
rust:
- stable
- nightly
matrix:
fast_finish: true
branches:
only:
- master
cache: cargo
before_cache: |
if [[ "$TRAVIS_RUST_VERSION" = nightly ]]; then
RUSTFLAGS="--cfg procmacro2_semver_exempt" cargo install cargo-tarpaulin -f
fi
script:
- cargo build --verbose
- cargo test --verbose
after_script: |
if [[ "$TRAVIS_OS_NAME" = linux && "$TRAVIS_RUST_VERSION" = nightly ]]; then
cargo tarpaulin --out Xml
bash <(curl -s https://codecov.io/bash)
fi
Generated
+148 -575
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -1,6 +1,6 @@
[package]
name = "findutils"
version = "0.4.2"
version = "0.3.0"
homepage = "https://github.com/uutils/findutils"
repository = "https://github.com/uutils/findutils"
edition = "2018"
@@ -15,16 +15,16 @@ clap = "2.34"
faccess = "0.2.4"
walkdir = "2.3"
regex = "1.7"
once_cell = "1.18"
once_cell = "1.17"
onig = "6.4"
uucore = { version = "0.0.20", features = ["entries", "fs", "fsext", "mode"] }
uucore = { version = "0.0.12", features = ["entries", "fs", "fsext", "mode"] }
[dev-dependencies]
assert_cmd = "2"
filetime = "0.2"
nix = "0.26"
predicates = "3"
serial_test = "2.0"
predicates = "2"
serial_test = "1.0"
tempfile = "3"
[[bin]]
+6
View File
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
]
}
+1 -1
View File
@@ -6,7 +6,7 @@
fn main() {
let args = std::env::args().collect::<Vec<String>>();
let strs: Vec<&str> = args.iter().map(std::convert::AsRef::as_ref).collect();
let strs: Vec<&str> = args.iter().map(|s| s.as_ref()).collect();
let deps = findutils::find::StandardDependencies::new();
std::process::exit(findutils::find::find_main(&strs, &deps));
}
+1 -1
View File
@@ -169,7 +169,7 @@ impl Pattern {
Self { regex }
}
/// Test if this pattern matches a string.
/// Test if this patern matches a string.
pub fn matches(&self, string: &str) -> bool {
self.regex.is_match(string)
}
+6 -10
View File
@@ -73,19 +73,15 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
}
+2 -2
View File
@@ -530,9 +530,9 @@ mod tests {
#[test]
fn not_has_side_effects_works() {
let has_fx = NotMatcher::new(HasSideEffects);
let has_no_fx = NotMatcher::new(FalseMatcher);
let hasnt_fx = NotMatcher::new(FalseMatcher);
assert!(has_fx.has_side_effects());
assert!(!has_no_fx.has_side_effects());
assert!(!hasnt_fx.has_side_effects());
}
#[test]
+2 -3
View File
@@ -611,7 +611,7 @@ mod tests {
let deps = FakeDependencies::new();
let matcher =
build_top_level_matcher(&[arg, "-name", "does_not_exist"], &mut config).unwrap();
build_top_level_matcher(&[arg, "-name", "doesntexist"], &mut config).unwrap();
assert!(matcher.matches(&abbbc_lower, &mut deps.new_matcher_io()));
assert_eq!(
@@ -652,8 +652,7 @@ mod tests {
config = Config::default();
let matcher =
build_top_level_matcher(&[arg, arg, "-name", "does_not_exist"], &mut config)
.unwrap();
build_top_level_matcher(&[arg, arg, "-name", "doesntexist"], &mut config).unwrap();
assert!(!matcher.matches(&abbbc_lower, &mut deps.new_matcher_io()));
}
+6 -10
View File
@@ -47,19 +47,15 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
}
+1 -1
View File
@@ -223,7 +223,7 @@ mod tests {
PermMatcher::new("d=rwx,g=rx,o+r").expect_err("invalid category should fail");
PermMatcher::new("u=dwx,g=rx,o+r").expect_err("invalid permission bit should fail");
PermMatcher::new("u_rwx,g=rx,o+r")
.expect_err("invalid category/permission separator should fail");
.expect_err("invalid category/permissoin separator should fail");
PermMatcher::new("77777777777777").expect_err("overflowing octal value should fail");
// FIXME: uucore::mode shouldn't accept this
+30 -50
View File
@@ -396,7 +396,7 @@ fn format_directive<'entry>(
// NOTE ON QUOTING:
// GNU find's man page claims that several directives that print names (like
// %f) are quoted like ls; however, I could not reproduce this at all in
// practice, thus the set of rules is undoubtedly very different (if this is
// pratice, thus the set of rules is undoubtedly very different (if this is
// still done at all).
let res: Cow<'entry, str> = match directive {
@@ -463,13 +463,11 @@ fn format_directive<'entry>(
#[cfg(unix)]
FormatDirective::Filesystem => {
let dev_id = meta()?.dev().to_string();
let fs_list =
uucore::fsext::read_fs_list().expect("Could not find the filesystem info");
fs_list
uucore::fsext::read_fs_list()
.into_iter()
.find(|fs| fs.dev_id == dev_id)
.map(|fs| fs.fs_type)
.unwrap_or_else(String::new)
.unwrap_or_else(|| "".to_owned())
.into()
}
@@ -948,70 +946,52 @@ mod tests {
#[cfg(unix)]
{
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink("subdir", "test_data/links/link-d") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink("missing", "test_data/links/link-missing") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink("abbbc/x", "test_data/links/link-notdir") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink("link-loop", "test_data/links/link-loop") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
}
#[cfg(windows)]
{
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink_dir("subdir", "test_data/links/link-d") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink_file("missing", "test_data/links/link-missing") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink_file("abbbc/x", "test_data/links/link-notdir") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
}
+3 -3
View File
@@ -261,7 +261,7 @@ mod tests {
deps.set_time(files_mtime - Duration::new(1_u64, 0));
assert!(
!exactly_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
"future-modified file shouldn't match exactly 1 day old"
"future-modified file shouldn'1 match exactly 1 day old"
);
assert!(
!more_than_one_day_matcher.matches(&file, &mut deps.new_matcher_io()),
@@ -311,14 +311,14 @@ mod tests {
}
thread::sleep(Duration::from_secs(2));
// read the file again - potentially changing accessed time
// read the file agaion - potentially changing accessed time
{
let mut f = File::open(&foo_path).expect("open temp file");
let _ = f.read(&mut buffer);
}
// OK our modification time and creation time should definitely be different
// and depending on our platform and file system, our accessed time might be
// and depending on our platform and file system, our accessed time migh be
// different too.
let file_info = get_dir_entry_for(&temp_dir.path().to_string_lossy(), "foo");
+18 -26
View File
@@ -87,7 +87,7 @@ mod tests {
let dir = get_dir_entry_for("test_data", "simple");
let deps = FakeDependencies::new();
let matcher = TypeMatcher::new("f").unwrap();
let matcher = TypeMatcher::new(&"f".to_string()).unwrap();
assert!(!matcher.matches(&dir, &mut deps.new_matcher_io()));
assert!(matcher.matches(&file, &mut deps.new_matcher_io()));
}
@@ -98,7 +98,7 @@ mod tests {
let dir = get_dir_entry_for("test_data", "simple");
let deps = FakeDependencies::new();
let matcher = TypeMatcher::new("d").unwrap();
let matcher = TypeMatcher::new(&"d".to_string()).unwrap();
assert!(matcher.matches(&dir, &mut deps.new_matcher_io()));
assert!(!matcher.matches(&file, &mut deps.new_matcher_io()));
}
@@ -108,37 +108,29 @@ mod tests {
#[test]
fn link_type_matcher() {
#[cfg(unix)]
{
let _ = {
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink("subdir", "test_data/links/link-d") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
};
#[cfg(windows)]
let _ = {
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
if let Err(e) = symlink_dir("subdir", "test_data/links/link-d") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
};
@@ -148,7 +140,7 @@ mod tests {
let dir = get_dir_entry_for("test_data", "links");
let deps = FakeDependencies::new();
let matcher = TypeMatcher::new("l").unwrap();
let matcher = TypeMatcher::new(&"l".to_string()).unwrap();
assert!(!matcher.matches(&dir, &mut deps.new_matcher_io()));
assert!(!matcher.matches(&file, &mut deps.new_matcher_io()));
assert!(matcher.matches(&link_f, &mut deps.new_matcher_io()));
@@ -163,7 +155,7 @@ mod tests {
let deps = FakeDependencies::new();
for typ in &["b", "c", "p", "s"] {
let matcher = TypeMatcher::new(typ.as_ref()).unwrap();
let matcher = TypeMatcher::new(&typ.to_string()).unwrap();
assert!(!matcher.matches(&dir, &mut deps.new_matcher_io()));
assert!(!matcher.matches(&file, &mut deps.new_matcher_io()));
}
@@ -171,7 +163,7 @@ mod tests {
#[test]
fn cant_create_with_invalid_pattern() {
let result = TypeMatcher::new("xxx");
let result = TypeMatcher::new(&"xxx".to_string());
assert!(result.is_err());
}
}
+7 -11
View File
@@ -338,19 +338,15 @@ mod tests {
fn create_file_link() {
#[cfg(unix)]
if let Err(e) = symlink("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
#[cfg(windows)]
if let Err(e) = symlink_file("abbbc", "test_data/links/link-f") {
assert!(
e.kind() == ErrorKind::AlreadyExists,
"Failed to create sym link: {:?}",
e
);
if e.kind() != ErrorKind::AlreadyExists {
panic!("Failed to create sym link: {:?}", e);
}
}
}
@@ -642,7 +638,7 @@ mod tests {
assert_eq!(rc, 0);
assert_eq!(
deps.get_output_as_string(),
new_dir.path().to_string_lossy().to_string() + "\n"
(&new_dir).path().to_string_lossy().to_string() + "\n"
);
// now do it the other way around, and nothing should be output
+5 -6
View File
@@ -37,7 +37,7 @@ fn open_file(destination_dir: &str) -> File {
loop {
file_number += 1;
let mut file_path: PathBuf = PathBuf::from(destination_dir);
file_path.push(format!("{file_number}.txt"));
file_path.push(format!("{}.txt", file_number));
if let Ok(f) = OpenOptions::new()
.write(true)
.create_new(true)
@@ -68,7 +68,7 @@ fn write_content(mut f: impl Write, config: &Config, args: &[String]) {
// the destination_dir we want to write to. Don't write either of those
// as they'll be non-deterministic.
for arg in &args[2..] {
writeln!(f, "{arg}").expect("failed to write to file");
writeln!(f, "{}", arg).expect("failed to write to file");
}
}
@@ -78,14 +78,13 @@ fn main() {
usage();
}
let mut config = Config {
destination_dir: if args[1] == "-" {
None
} else {
destination_dir: if args[1] != "-" {
Some(args[1].clone())
} else {
None
},
..Default::default()
};
for arg in &args[2..] {
if arg.starts_with("--") {
match arg.as_ref() {
+1 -4
View File
@@ -7,9 +7,6 @@
fn main() {
let args = std::env::args().collect::<Vec<String>>();
std::process::exit(findutils::xargs::xargs_main(
&args
.iter()
.map(std::convert::AsRef::as_ref)
.collect::<Vec<&str>>(),
&args.iter().map(|s| s.as_ref()).collect::<Vec<&str>>(),
))
}

Some files were not shown because too many files have changed in this diff Show More