Commit graph

178 commits

Author SHA1 Message Date
Thayne McCombs
8897659607 tests: Add tests for ignoring .git/ 2023-10-23 08:34:03 +02:00
Thayne McCombs
054bae01ef maint: Remove use of unmaintained users crate
The users crate is no longer maintained. There is a maintained fork
called uzers, but we already have a dependency on nix, and that has the
functionality we need.
2023-10-21 23:37:32 -06:00
Eden Mikitas
dea9110b90 Making -1 conflict with --exec and making max-results override -1 2023-10-05 15:10:37 +03:00
David Peter
73a693ef28
Merge pull request #1244 from tmccombs/grouped-occurrences
update: Update to clap 4.1
2023-02-01 21:36:19 +01:00
David Peter
af9daff4ee
Merge pull request #1216 from vegerot/pr1216
Add flag --no-require-git to always respect gitignore files
2023-01-17 14:37:14 +01:00
Thayne McCombs
10ba34f78b update: Update to clap 4.1
This includes switching to the stable API for getting values grouped by
occurrences, and updating tests to match the new error messages.
2023-01-17 00:17:50 -07:00
Thayne McCombs
503ede7535
Merge pull request #1212 from sharkdp/global-ignore-test
Add tests for global ignore file
2023-01-16 00:55:30 -07:00
Max 👨🏽‍💻 Coplan
08c0d427bf Add flag --no-require-git to always respect gitignore files
Summary: Currently, `--ignore-vcs` only serves to unset `--no-ignore-vcs`.
There is currently no way to tell fd to respect gitignore files when not in a
git repository.  This commit adds the flag `--no-require-git` to make fd always
respect all gitignore files.

This behaves the same as the `--no-require-git` option in [ripgrep](3bb71b0cb8/crates/core/app.rs (L2214-L2226))

This commit also contains an unrelated wording fix to CONTRIBUTING.md

Test Plan: `tests/tests.rs`

Background: I am using [Sapling](https://sapling-scm.com/docs/introduction/)
for working with git repositories (including this commit ☺️).  Since Sapling
uses `.sl` instead of `.git`, tools using the `ignore` crate (rg and fd) would show gitignored files.
I made a patch (ebf17eef22)
to `ignore` to respect gitignores with _either_ `.git` or `.sl`.  However,
@BurntSushi said he did not want to merge that patch and instead suggested I
use `--no-require-git` (https://github.com/BurntSushi/ripgrep/issues/2374).
This works fine, but I couldn't use this workaround for my other favorite tool!
That's what this patch is for 😁

(a follow-up patch will add a similar `FD_CONFIG_PATH` environment variable
like `RG_CONFIG_PATH`)
2023-01-13 13:52:34 -08:00
Thayne McCombs
a36f2cf61c Skip an executable test if running as root
Fixes #1214
2022-12-28 23:28:41 -07:00
Thayne McCombs
b6c7ebc4f1 Don't test global ignore file on windows
Becase XDG_CONFIG_HOME doesn't work there.
2022-12-18 23:33:32 -07:00
Thayne McCombs
fd707b42c2 Add tests for global ignore file 2022-12-18 00:42:54 -07:00
Thayne McCombs
7ec795cd57 Change full-path tests to work on windows as well 2022-12-03 22:30:32 -07:00
Thayne McCombs
0a575763a1 Change full path tests to be more resilient
Use patterns that won't conflict with randomly generated portion of
temporary directory

Fixes: #1181
2022-12-01 22:02:19 -07:00
Thayne McCombs
650a511fa4 Use tempfile instead of tempdir
Because tempdir is no longer maintained, because it has been combined
with the tempfile crate.

Relates-To: #1188
2022-11-30 02:26:16 -07:00
Ptipiak
cd5fad3cf3 Adding a simple test for executable files 2022-11-26 10:09:40 +01:00
Kasper Gałkowski
7e26925933 Added the --and flag for matching multiple patterns 2022-11-21 21:06:48 +01:00
Thayne McCombs
38d406876d Fix a couple small clippy warnings
- suppress warning about unused function on windows
- remove extraneous & in test
2022-11-11 02:12:58 -07:00
Thayne McCombs
b04cae2ca0 Only run owner root test on linux
Because macos doesn't have a "root" user
2022-11-02 23:55:31 -06:00
Thayne McCombs
c159ea2042 Fix panic when using --owner
Unfortunately, clap_derive can't combine a value_parser of Option<T>
with an optional argument to get a merged Option<T> so we need to do the
check for the nop outside of the value parser.

Also adds some tests for --owner

Fixes: #1163
2022-11-02 23:26:02 -06:00
David Peter
f15be89bff Fix --threads/-j option value parsing 2022-11-02 13:32:22 +01:00
David Peter
ac35b11dc8 Change clap CLI binary name to 'fd' 2022-11-01 21:00:32 +01:00
David Peter
b57ed11f65
Merge pull request #1137 from amesgen/batch-exit-code
Respect exit codes with `--exec-batch`
2022-11-01 20:42:28 +01:00
David Peter
ebd48d406e Fix unit tests 2022-11-01 20:12:56 +01:00
amesgen
cb95f1dcd5
Respect exit codes with --exec-batch 2022-10-13 23:33:54 +02:00
Thayne McCombs
10ecb64ff3 Fix typo in test 2022-10-10 23:58:33 -06:00
Thayne McCombs
c41d61eeda Merge remote-tracking branch 'upstream/master' into clap-derive 2022-10-09 01:00:48 -06:00
Thayne McCombs
f4c34b81c7 Upgrade to clap 4.0 2022-10-08 23:51:45 -06:00
Thayne McCombs
4e7b403c1f Use clap-derive for option parsing
This makes the definition of arguments to fd a little more ergonomic,
and makes it easier to insure the types for the arguments are consitent.
2022-10-08 00:41:33 -06:00
Tavian Barnes
4ffc34956f Make --strip-cwd-prefix apply to -x/-X
Fixes #898.
2022-10-03 21:35:39 +02:00
Tavian Barnes
4419401b6c Enable --strip-cwd-prefix by default except with -0
Fixes #1046.
2022-09-27 20:56:24 +02:00
Sijmen
a0062b9a1b Disable invalid CWD test on Windows 2022-08-10 20:01:21 +02:00
Sijmen
922f127aca Add test when running from non-existent directory
When fd is run from a non-existent directory, but a search path is
passed in the arguments, it should still run. This tests for that.
2022-08-10 20:01:21 +02:00
David Peter
941f712975 Fix (pointless) clippy suggestion 2022-05-28 22:40:07 +02:00
Tavian Barnes
40b368e761 exec: Execute batches before they get too long
Fixes #410.
2022-05-28 22:19:47 +02:00
David Peter
41affe18c4 Merge remote-tracking branch 'origin/master' into yyogo/master 2022-05-15 16:31:06 +02:00
Jackson Theel
cbf3f11cf8 Make -u idempotent 2022-05-15 16:22:24 +02:00
Thayne McCombs
50c0fa812f
Merge branch 'master' into master 2022-03-15 01:20:35 -06:00
Thayne McCombs
9f39f1d75b Add tests for multiple execs 2022-03-08 10:15:48 +01:00
Thayne McCombs
43f276e073 Upgrade to clap 3.0
This wasn't backwards compatible so required some more substantial
changes.
2022-01-07 23:56:03 -07:00
Thayne McCombs
06cd391845 Change test_opposing to be less flaky.
Make it resilient to the different invocations returning results in
different orders.
2022-01-07 03:10:09 -07:00
Thayne McCombs
b7e077320d
Fix logic for --no-ignore-parent (#908)
Make sure that using `--no-ignore-vcs` or `--no-ignore` don't also
enable `--no-ignore-parent`. So that if `--no-ignore-vcs` is enabled, it
continues to respect .fdignore and .ignore in the parent directories.

Fixes: #907
Fixes: #901
2021-12-22 23:38:00 -07:00
Jonathan Goren
1153e3e155 tests: fix for trailing slashes 2021-12-11 15:43:24 +02:00
David Peter
92bd7850d0 Merge remote-tracking branch 'origin/master' into no-strip/760 2021-11-26 18:19:28 +01:00
David Peter
47421a49b8 Remove strip-prefix placeholders 2021-11-26 17:58:18 +01:00
David Peter
4d7e34ad59 Rename option to strip_cwd_prefix, rename CLI option 2021-11-26 17:46:04 +01:00
David Peter
13cdfb32f8 Remove outdated comment 2021-11-26 17:40:07 +01:00
David Peter
cdc6a37ed6 Merge remote-tracking branch 'origin/master' into pr/opposing-options 2021-11-14 16:47:53 +01:00
Devon Hollowood
17dd2a6dfe
Implement --batch-size (#866) 2021-10-22 00:05:13 -06:00
Jonah Caplan
bf9e6fd36e add -P option to strip prefix to tty 2021-10-17 00:29:51 -04:00
Jonah Caplan
46db1c4ef3 add {-} format for exec 2021-10-16 23:52:04 -04:00