Skip to content
Myr

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

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by David Peter · committed by David Peter · parents 60c14b1, dcde6d3 · Browse files · 9 files+76 added−56 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

9 files+76 added−56 removed

  • tests:+1 added−13 removed
  • other:+75 added−43 removed

9 files+76 added−56 removed

modified:doc/fd.1+1 added-1 removed
56 unmodified lines
57.IP58The flag can be overridden with '--ignore'.59.TP60.B \-u, \-\-unrestricted61Alias for '--no-ignore'. Can be repeated; '-uu' is an alias for '--no-ignore --hidden'.61Perform an unrestricted search, including ignored and hidden files. This is an alias for '--hidden --no-ignore'.62.TP63.B \-\-no\-ignore\-vcs64Show search results from files and directories that would otherwise be ignored by gitignore files65including
399 unmodified lines
modified:src/app.rs+4 added-4 removed
100 unmodified lines
101 Arg::new("rg-alias-hidden-ignore")102 .short('u')103 .long("unrestricted")104 .overrides_with_all(&["ignore", "no-hidden"])105 .multiple_occurrences(true)105 .multiple_occurrences(true) // Allowed for historical reasons106 .hide_short_help(true)107 .help("Alias for '--no-ignore', and '--hidden' when given twice")107 .help("Unrestricted search, alias for '--no-ignore --hidden'")108 .long_help(109 "Alias for '--no-ignore'. Can be repeated. '-uu' is an alias for \110 '--no-ignore --hidden'.",109 "Perform an unrestricted search, including ignored and hidden files. This is \110 an alias for '--no-ignore --hidden'."111 ),112 )113 .arg(114 Arg::new("case-sensitive")
658 unmodified lines
modified:src/main.rs+1 added-1 removed
258 unmodified lines
259 Ok(Config {260 case_sensitive,261 search_full_path: matches.is_present("full-path"),262 ignore_hidden: !(matches.is_present("hidden")263 || matches.occurrences_of("rg-alias-hidden-ignore") >= 2),263 || matches.is_present("rg-alias-hidden-ignore")),264 read_fdignore: !(matches.is_present("no-ignore")265 || matches.is_present("rg-alias-hidden-ignore")),266 read_vcsignore: !(matches.is_present("no-ignore")267 || matches.is_present("rg-alias-hidden-ignore")
302 unmodified lines
modified:src/regex_helper.rs+10 added-10 removed
13 unmodified lines
14/// Determine if a regex expression contains a literal uppercase character.15fn hir_has_uppercase_char(hir: &Hir) -> bool {16 use regex_syntax::hir::*;1718 match *hir.kind() {18 match hir.kind() {19 HirKind::Literal(Literal::Unicode(c)) => c.is_uppercase(),20 HirKind::Literal(Literal::Byte(b)) => char::from(b).is_uppercase(),21 HirKind::Class(Class::Unicode(ref ranges)) => ranges20 HirKind::Literal(Literal::Byte(b)) => char::from(*b).is_uppercase(),21 HirKind::Class(Class::Unicode(ranges)) => ranges22 .iter()23 .any(|r| r.start().is_uppercase() || r.end().is_uppercase()),24 HirKind::Class(Class::Bytes(ref ranges)) => ranges24 HirKind::Class(Class::Bytes(ranges)) => ranges25 .iter()26 .any(|r| char::from(r.start()).is_uppercase() || char::from(r.end()).is_uppercase()),27 HirKind::Group(Group { ref hir, .. }) | HirKind::Repetition(Repetition { ref hir, .. }) => {27 HirKind::Group(Group { hir, .. }) | HirKind::Repetition(Repetition { hir, .. }) => {28 hir_has_uppercase_char(hir)29 }30 HirKind::Concat(ref hirs) | HirKind::Alternation(ref hirs) => {30 HirKind::Concat(hirs) | HirKind::Alternation(hirs) => {31 hirs.iter().any(hir_has_uppercase_char)32 }33 _ => false,34 }
16 unmodified lines
51 // Note: this only really detects the simplest case where a regex starts with52 // "^\\.", i.e. a start text anchor and a literal dot character. There are a lot53 // of other patterns that ONLY match hidden files, e.g. ^(\\.foo|\\.bar) which are54 // not (yet) detected by this algorithm.55 match *hir.kind() {56 HirKind::Concat(ref hirs) => {55 match hir.kind() {56 HirKind::Concat(hirs) => {57 let mut hirs = hirs.iter();58 if let Some(hir) = hirs.next() {59 if *hir.kind() != HirKind::Anchor(Anchor::StartText) {59 if hir.kind() != &HirKind::Anchor(Anchor::StartText) {60 return false;61 }62 } else {63 return false;64 }6566 if let Some(hir) = hirs.next() {67 *hir.kind() == HirKind::Literal(Literal::Unicode('.'))67 hir.kind() == &HirKind::Literal(Literal::Unicode('.'))68 } else {69 false70 }71 }
29 unmodified lines
modified:tests/tests.rs+1 added-13 removed
654 unmodified lines
655 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);656657 te.assert_output(658 &["-u", "foo"],659 "./a.foo660 ./fdignored.foo661 ./gitignored.foo662 ./one/b.foo663 ./one/two/c.foo664 ./one/two/C.Foo2665 ./one/two/three/d.foo666 ./one/two/three/directory_foo/",667 );668669 te.assert_output(670 &["-uu", "foo"],659 "./.hidden.foo660 ./a.foo661 ./fdignored.foo662 ./gitignored.foo
1363 unmodified lines
2026#[test_case("--no-ignore", &["--ignore"] ; "no-ignore")]2027#[test_case("--no-ignore-vcs", &["--ignore-vcs"] ; "no-ignore-vcs")]2028#[test_case("--follow", &["--no-follow"] ; "follow")]2029#[test_case("--absolute-path", &["--relative-path"] ; "absolute-path")]2042#[test_case("-u", &["--ignore"] ; "u")]2030#[test_case("-u", &["--ignore", "--no-hidden"] ; "u")]2031#[test_case("-uu", &["--ignore", "--no-hidden"] ; "uu")]2032fn test_opposing(flag: &str, opposing_flags: &[&str]) {2033 let te = TestEnv::new(DEFAULT_DIRS, DEFAULT_FILES);2034
48 unmodified lines
modified:Cargo.lock+28 added-23 removed
20 unmodified lines
21]2223[[package]]24name = "anyhow"25version = "1.0.55"25version = "1.0.57"26source = "registry+https://github.com/rust-lang/crates.io-index"27checksum = "159bb86af3a200e19a068f4224eae4c8bb2d0fa054c7e5d1cacd5cef95e684cd"27checksum = "08f9b8508dccb7687a1d6c4ce66b2b0ecef467c94667de27d8d7fe1f8d2a9cdc"2829[[package]]30name = "atty"31version = "0.2.14"
52 unmodified lines
84]8586[[package]]87name = "clap"88version = "3.1.5"88version = "3.1.14"89source = "registry+https://github.com/rust-lang/crates.io-index"90checksum = "ced1892c55c910c1219e98d6fc8d71f6bddba7905866ce740066d8bfea859312"90checksum = "535434c063ced786eb04aaf529308092c5ab60889e8fe24275d15de07b01fa97"91dependencies = [92 "atty",93 "bitflags",94 "clap_lex",95 "indexmap",96 "lazy_static",96 "os_str_bytes",97 "strsim",98 "termcolor",99 "terminal_size",100 "textwrap",101]102103[[package]]104name = "clap_complete"105version = "3.1.1"105version = "3.1.3"106source = "registry+https://github.com/rust-lang/crates.io-index"107checksum = "df6f3613c0a3cddfd78b41b10203eb322cb29b600cbdf808a7d3db95691b8e25"107checksum = "1d7ca9141e27e6ebc52e3c378b0c07f3cea52db46ed1cc5861735fb697b56356"108dependencies = [109 "clap",110]111112[[package]]113name = "clap_lex"114version = "0.2.0"115source = "registry+https://github.com/rust-lang/crates.io-index"116checksum = "a37c35f1112dad5e6e0b1adaff798507497a18fceeb30cceb3bae7d1427b9213"117dependencies = [118 "os_str_bytes",119]120121[[package]]122name = "crossbeam-utils"123version = "0.8.7"124source = "registry+https://github.com/rust-lang/crates.io-index"125checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6"
3 unmodified lines
129]130131[[package]]132name = "ctrlc"124version = "3.2.1"133version = "3.2.2"134source = "registry+https://github.com/rust-lang/crates.io-index"126checksum = "a19c6cedffdc8c03a3346d723eb20bd85a13362bb96dc2ac000842c6381ec7bf"135checksum = "b37feaa84e6861e00a1f5e5aa8da3ee56d605c9992d33e082786754828e20865"136dependencies = [137 "nix",138 "winapi",139]
188 unmodified lines
328checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"329330[[package]]331name = "libc"323version = "0.2.119"332version = "0.2.125"333source = "registry+https://github.com/rust-lang/crates.io-index"325checksum = "1bf2e165bb3457c8e098ea76f3e3bc9db55f87aa90d52d0e6be741470916aaa4"334checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b"335336[[package]]337name = "log"338version = "0.4.14"
28 unmodified lines
367]368369[[package]]370name = "nix"362version = "0.23.1"371version = "0.24.1"372source = "registry+https://github.com/rust-lang/crates.io-index"364checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"373checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"374dependencies = [375 "bitflags",367 "cc",376 "cfg-if",377 "libc",378 "memoffset",379]
37 unmodified lines
417]418419[[package]]420name = "once_cell"413version = "1.9.0"421version = "1.10.0"422source = "registry+https://github.com/rust-lang/crates.io-index"415checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"423checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"424425[[package]]426name = "os_str_bytes"427version = "6.0.0"428source = "registry+https://github.com/rust-lang/crates.io-index"429checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"422dependencies = [423 "memchr",424]430431[[package]]432name = "proc-macro-error"433version = "1.0.4"
93 unmodified lines
527]528529[[package]]530name = "regex"526version = "1.5.4"531version = "1.5.5"532source = "registry+https://github.com/rust-lang/crates.io-index"528checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"533checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"534dependencies = [535 "aho-corasick",536 "memchr",537 "regex-syntax",
70 unmodified lines
608]609610[[package]]611name = "test-case"607version = "2.0.0"612version = "2.0.2"613source = "registry+https://github.com/rust-lang/crates.io-index"609checksum = "4f7d58e237f65d5fe5eaf1105188c94c9a441e1fbc298ed5df45ec9c9af236d3"614checksum = "6344589a99d3971d6fa4e8314dbcbeca2df6273a6b642e46906971779159af1f"615dependencies = [616 "cfg-if",617 "proc-macro-error",618 "proc-macro2",
101 unmodified lines
modified:Cargo.toml+3 added-3 removed
modified:CHANGELOG.md+5 added-1 removed
3 unmodified lines
456## Features78- Support multiple `--exec <cmd>` instances, see #406 and 9#960 (@tmccombs)1011## Bugfixes121314## Changes1516- Changed `-u` flag to be equivalent to `-HI`. Multiple `-u` flags still allowed but do nothing, see #840 (@jacksontheel)14- Directories are now printed with an additional path separator at the end: `foo/bar/`17- Directories are now printed with an additional path separator at the end: `foo/bar/`, see #436 and #812 (@yyogo)1819## Other2021- Added installation instructions for RHEL8, see #989 (@ethsol)2223# v8.3.22425## Bugfixes
568 unmodified lines
modified:README.md+23 added
590 unmodified lines
591```592xbps-install -S fd593```594595### On RedHat Enterprise Linux 8 (RHEL8) or Almalinux 8 or Rocky Linux 8596597Get the latest fd-v*-x86_64-unknown-linux-gnu.tar.gz file from [sharkdp on github](https://github.com/sharkdp/fd/releases)598```599tar xf fd-v*-x86_64-unknown-linux-gnu.tar.gz600chown -R root:root fd-v*-x86_64-unknown-linux-gnu601cd fd-v*-x86_64-unknown-linux-gnu602sudo cp fd /bin603gzip fd.1604chown root:root fd.1.gz605sudo cp fd.1.gz /usr/share/man/man1606sudo cp autocomplete/fd.bash /usr/share/bash-completion/completions/fd607source /usr/share/bash-completion/completions/fd608fd 609```610611### On macOS612613You can install `fd` with [Homebrew](https://formulae.brew.sh/formula/fd):614```
18 unmodified lines
633```634choco install fd635```636637### On GuixOS638639You can install [the fd package](https://guix.gnu.org/en/packages/fd-8.1.1/) from the official repo:640```641guix install fd642```643644### On NixOS / via Nix645646You can use the [Nix package manager](https://nixos.org/nix/) to install `fd`:647```
60 unmodified lines