Merge remote-tracking branch 'origin/master' into yyogo/master

This commit is contained in:
David Peter 2022-05-15 16:31:06 +02:00
commit 41affe18c4
9 changed files with 76 additions and 56 deletions

View File

@ -5,16 +5,20 @@
## Features ## Features
- Support multiple `--exec <cmd>` instances, see #406 and
#960 (@tmccombs)
## Bugfixes ## Bugfixes
## Changes ## Changes
- Directories are now printed with an additional path separator at the end: `foo/bar/` - Changed `-u` flag to be equivalent to `-HI`. Multiple `-u` flags still allowed but do nothing, see #840 (@jacksontheel)
- Directories are now printed with an additional path separator at the end: `foo/bar/`, see #436 and #812 (@yyogo)
## Other ## Other
- Added installation instructions for RHEL8, see #989 (@ethsol)
# v8.3.2 # v8.3.2

51
Cargo.lock generated
View File

@ -22,9 +22,9 @@ dependencies = [
[[package]] [[package]]
name = "anyhow" name = "anyhow"
version = "1.0.55" version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd" checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"
[[package]] [[package]]
name = "atty" name = "atty"
@ -85,15 +85,15 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "3.1.5" version = "3.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312" checksum = "535434c063ced786eb04aaf529308092c5ab60889e8fe24275d15de07b01fa97"
dependencies = [ dependencies = [
"atty", "atty",
"bitflags", "bitflags",
"clap_lex",
"indexmap", "indexmap",
"lazy_static", "lazy_static",
"os_str_bytes",
"strsim", "strsim",
"termcolor", "termcolor",
"terminal_size", "terminal_size",
@ -102,13 +102,22 @@ dependencies = [
[[package]] [[package]]
name = "clap_complete" name = "clap_complete"
version = "3.1.1" version = "3.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25" checksum = "1d7ca9141e27e6ebc52e3c378b0c07f3cea52db46ed1cc5861735fb697b56356"
dependencies = [ dependencies = [
"clap", "clap",
] ]
[[package]]
name = "clap_lex"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"
dependencies = [
"os_str_bytes",
]
[[package]] [[package]]
name = "crossbeam-utils" name = "crossbeam-utils"
version = "0.8.7" version = "0.8.7"
@ -121,9 +130,9 @@ dependencies = [
[[package]] [[package]]
name = "ctrlc" name = "ctrlc"
version = "3.2.1" version = "3.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf" checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865"
dependencies = [ dependencies = [
"nix", "nix",
"winapi", "winapi",
@ -320,9 +329,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.2.119" version = "0.2.125"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4" checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"
[[package]] [[package]]
name = "log" name = "log"
@ -359,12 +368,11 @@ dependencies = [
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.23.1" version = "0.24.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cc",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset", "memoffset",
@ -410,18 +418,15 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.9.0" version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
[[package]] [[package]]
name = "os_str_bytes" name = "os_str_bytes"
version = "6.0.0" version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64" checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
dependencies = [
"memchr",
]
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
@ -523,9 +528,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.4" version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461" checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@ -604,9 +609,9 @@ dependencies = [
[[package]] [[package]]
name = "test-case" name = "test-case"
version = "2.0.0" version = "2.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4f7d58e237f65d5fe5eaf1105188c94c9a441e1fbc298ed5df45ec9c9af236d3" checksum = "6344589a99d3971d6fa4e8314dbcbeca2df6273a6b642e46906971779159af1f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"proc-macro-error", "proc-macro-error",

View File

@ -39,7 +39,7 @@ ansi_term = "0.12"
atty = "0.2" atty = "0.2"
ignore = "0.4.3" ignore = "0.4.3"
num_cpus = "1.13" num_cpus = "1.13"
regex = "1.5.4" regex = "1.5.5"
regex-syntax = "0.6" regex-syntax = "0.6"
ctrlc = "3.2" ctrlc = "3.2"
humantime = "2.1" humantime = "2.1"
@ -49,7 +49,7 @@ anyhow = "1.0"
dirs-next = "2.0" dirs-next = "2.0"
normpath = "0.3.2" normpath = "0.3.2"
chrono = "0.4" chrono = "0.4"
once_cell = "1.9.0" once_cell = "1.10.0"
[dependencies.clap] [dependencies.clap]
version = "3.1" version = "3.1"
@ -57,7 +57,7 @@ features = ["suggestions", "color", "wrap_help", "cargo", "unstable-grouped"]
[target.'cfg(unix)'.dependencies] [target.'cfg(unix)'.dependencies]
users = "0.11.0" users = "0.11.0"
nix = "0.23.1" nix = "0.24.1"
[target.'cfg(all(unix, not(target_os = "redox")))'.dependencies] [target.'cfg(all(unix, not(target_os = "redox")))'.dependencies]
libc = "0.2" libc = "0.2"

View File

@ -592,6 +592,22 @@ You can install `fd` via xbps-install:
xbps-install -S fd xbps-install -S fd
``` ```
### On RedHat Enterprise Linux 8 (RHEL8) or Almalinux 8 or Rocky Linux 8
Get the latest fd-v*-x86_64-unknown-linux-gnu.tar.gz file from [sharkdp on github](https://github.com/sharkdp/fd/releases)
```
tar xf fd-v*-x86_64-unknown-linux-gnu.tar.gz
chown -R root:root fd-v*-x86_64-unknown-linux-gnu
cd fd-v*-x86_64-unknown-linux-gnu
sudo cp fd /bin
gzip fd.1
chown root:root fd.1.gz
sudo cp fd.1.gz /usr/share/man/man1
sudo cp autocomplete/fd.bash /usr/share/bash-completion/completions/fd
source /usr/share/bash-completion/completions/fd
fd
```
### On macOS ### On macOS
You can install `fd` with [Homebrew](https://formulae.brew.sh/formula/fd): You can install `fd` with [Homebrew](https://formulae.brew.sh/formula/fd):
@ -618,6 +634,13 @@ Or via [Chocolatey](https://chocolatey.org):
choco install fd choco install fd
``` ```
### On GuixOS
You can install [the fd package](https://guix.gnu.org/en/packages/fd-8.1.1/) from the official repo:
```
guix install fd
```
### On NixOS / via Nix ### On NixOS / via Nix
You can use the [Nix package manager](https://nixos.org/nix/) to install `fd`: You can use the [Nix package manager](https://nixos.org/nix/) to install `fd`:

2
doc/fd.1 vendored
View File

@ -58,7 +58,7 @@ The global fd ignore file (usually
The flag can be overridden with '--ignore'. The flag can be overridden with '--ignore'.
.TP .TP
.B \-u, \-\-unrestricted .B \-u, \-\-unrestricted
Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'. Perform an unrestricted search, including ignored and hidden files. This is an alias for '--hidden --no-ignore'.
.TP .TP
.B \-\-no\-ignore\-vcs .B \-\-no\-ignore\-vcs
Show search results from files and directories that would otherwise be ignored by gitignore files Show search results from files and directories that would otherwise be ignored by gitignore files

View File

@ -102,12 +102,12 @@ pub fn build_app() -> Command<'static> {
.short('u') .short('u')
.long("unrestricted") .long("unrestricted")
.overrides_with_all(&["ignore", "no-hidden"]) .overrides_with_all(&["ignore", "no-hidden"])
.multiple_occurrences(true) .multiple_occurrences(true) // Allowed for historical reasons
.hide_short_help(true) .hide_short_help(true)
.help("Alias for '--no-ignore', and '--hidden' when given twice") .help("Unrestricted search, alias for '--no-ignore --hidden'")
.long_help( .long_help(
"Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for \ "Perform an unrestricted search, including ignored and hidden files. This is \
'--no-ignore --hidden'.", an alias for '--no-ignore --hidden'."
), ),
) )
.arg( .arg(

View File

@ -260,7 +260,7 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
case_sensitive, case_sensitive,
search_full_path: matches.is_present("full-path"), search_full_path: matches.is_present("full-path"),
ignore_hidden: !(matches.is_present("hidden") ignore_hidden: !(matches.is_present("hidden")
|| matches.occurrences_of("rg-alias-hidden-ignore") >= 2), || matches.is_present("rg-alias-hidden-ignore")),
read_fdignore: !(matches.is_present("no-ignore") read_fdignore: !(matches.is_present("no-ignore")
|| matches.is_present("rg-alias-hidden-ignore")), || matches.is_present("rg-alias-hidden-ignore")),
read_vcsignore: !(matches.is_present("no-ignore") read_vcsignore: !(matches.is_present("no-ignore")

View File

@ -15,19 +15,19 @@ pub fn pattern_has_uppercase_char(pattern: &str) -> bool {
fn hir_has_uppercase_char(hir: &Hir) -> bool { fn hir_has_uppercase_char(hir: &Hir) -> bool {
use regex_syntax::hir::*; use regex_syntax::hir::*;
match *hir.kind() { match hir.kind() {
HirKind::Literal(Literal::Unicode(c)) => c.is_uppercase(), HirKind::Literal(Literal::Unicode(c)) => c.is_uppercase(),
HirKind::Literal(Literal::Byte(b)) => char::from(b).is_uppercase(), HirKind::Literal(Literal::Byte(b)) => char::from(*b).is_uppercase(),
HirKind::Class(Class::Unicode(ref ranges)) => ranges HirKind::Class(Class::Unicode(ranges)) => ranges
.iter() .iter()
.any(|r| r.start().is_uppercase() || r.end().is_uppercase()), .any(|r| r.start().is_uppercase() || r.end().is_uppercase()),
HirKind::Class(Class::Bytes(ref ranges)) => ranges HirKind::Class(Class::Bytes(ranges)) => ranges
.iter() .iter()
.any(|r| char::from(r.start()).is_uppercase() || char::from(r.end()).is_uppercase()), .any(|r| char::from(r.start()).is_uppercase() || char::from(r.end()).is_uppercase()),
HirKind::Group(Group { ref hir, .. }) | HirKind::Repetition(Repetition { ref hir, .. }) => { HirKind::Group(Group { hir, .. }) | HirKind::Repetition(Repetition { hir, .. }) => {
hir_has_uppercase_char(hir) hir_has_uppercase_char(hir)
} }
HirKind::Concat(ref hirs) | HirKind::Alternation(ref hirs) => { HirKind::Concat(hirs) | HirKind::Alternation(hirs) => {
hirs.iter().any(hir_has_uppercase_char) hirs.iter().any(hir_has_uppercase_char)
} }
_ => false, _ => false,
@ -52,11 +52,11 @@ fn hir_matches_strings_with_leading_dot(hir: &Hir) -> bool {
// "^\\.", i.e. a start text anchor and a literal dot character. There are a lot // "^\\.", i.e. a start text anchor and a literal dot character. There are a lot
// of other patterns that ONLY match hidden files, e.g. ^(\\.foo|\\.bar) which are // of other patterns that ONLY match hidden files, e.g. ^(\\.foo|\\.bar) which are
// not (yet) detected by this algorithm. // not (yet) detected by this algorithm.
match *hir.kind() { match hir.kind() {
HirKind::Concat(ref hirs) => { HirKind::Concat(hirs) => {
let mut hirs = hirs.iter(); let mut hirs = hirs.iter();
if let Some(hir) = hirs.next() { if let Some(hir) = hirs.next() {
if *hir.kind() != HirKind::Anchor(Anchor::StartText) { if hir.kind() != &HirKind::Anchor(Anchor::StartText) {
return false; return false;
} }
} else { } else {
@ -64,7 +64,7 @@ fn hir_matches_strings_with_leading_dot(hir: &Hir) -> bool {
} }
if let Some(hir) = hirs.next() { if let Some(hir) = hirs.next() {
*hir.kind() == HirKind::Literal(Literal::Unicode('.')) hir.kind() == &HirKind::Literal(Literal::Unicode('.'))
} else { } else {
false false
} }

View File

@ -656,18 +656,6 @@ fn test_no_ignore_aliases() {
te.assert_output( te.assert_output(
&["-u", "foo"], &["-u", "foo"],
"./a.foo
./fdignored.foo
./gitignored.foo
./one/b.foo
./one/two/c.foo
./one/two/C.Foo2
./one/two/three/d.foo
./one/two/three/directory_foo/",
);
te.assert_output(
&["-uu", "foo"],
"./.hidden.foo "./.hidden.foo
./a.foo ./a.foo
./fdignored.foo ./fdignored.foo
@ -2039,7 +2027,7 @@ fn test_number_parsing_errors() {
#[test_case("--no-ignore-vcs", &["--ignore-vcs"] ; "no-ignore-vcs")] #[test_case("--no-ignore-vcs", &["--ignore-vcs"] ; "no-ignore-vcs")]
#[test_case("--follow", &["--no-follow"] ; "follow")] #[test_case("--follow", &["--no-follow"] ; "follow")]
#[test_case("--absolute-path", &["--relative-path"] ; "absolute-path")] #[test_case("--absolute-path", &["--relative-path"] ; "absolute-path")]
#[test_case("-u", &["--ignore"] ; "u")] #[test_case("-u", &["--ignore", "--no-hidden"] ; "u")]
#[test_case("-uu", &["--ignore", "--no-hidden"] ; "uu")] #[test_case("-uu", &["--ignore", "--no-hidden"] ; "uu")]
fn test_opposing(flag: &str, opposing_flags: &[&str]) { fn test_opposing(flag: &str, opposing_flags: &[&str]) {
let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES); let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);