Checks
Bug
I believe this is a bug. It's probably at least tangentially related to #851, #374, and #1577.
When multiple --search-path arguments are supplied, fd appears to ignore (not respect) the --exclude directive when processing dirs after the first search path.
Repro
I wrote a very simple bash script to repro this:
#!/usr/bin/env bash
fd --version
echo "only 'myfile1.txt' should be found"
echo
# dir1
mkdir -p ~/test/abc/def
mkdir -p ~/test/ghi/def
touch ~/test/abc/def/myfile1.txt
touch ~/test/ghi/def/myfile2.txt
# dir2
mkdir -p ~/test2/abc/def
mkdir -p ~/test2/ghi/def
touch ~/test2/abc/def/myfile1.txt
touch ~/test2/ghi/def/myfile2.txt
echo "this works: --exclude 'ghi'"
fd --type file --search-path ~/test --search-path ~/test2 --exclude 'ghi'
echo
echo "this also works: --exclude '**/ghi/def'"
fd --type file --search-path ~/test --search-path ~/test2 --exclude '**/ghi/def'
echo
echo "this seems to NOT work as expected: --exclude 'ghi/def'"
echo "(~/test2/ghi/def/myfile2.txt will be shown)"
fd --type file --search-path ~/test --search-path ~/test2 --exclude 'ghi/def'
Output
$ ./fd_repro.sh
fd 10.4.2
only 'myfile1.txt' should be found
this works: --exclude 'ghi'
/Users/luke/test/abc/def/myfile1.txt
/Users/luke/test2/abc/def/myfile1.txt
this also works: --exclude '**/ghi/def'
/Users/luke/test/abc/def/myfile1.txt
/Users/luke/test2/abc/def/myfile1.txt
this seems to NOT work as expected: --exclude 'ghi/def'
(~/test2/ghi/def/myfile2.txt will be shown)
/Users/luke/test/abc/def/myfile1.txt
/Users/luke/test2/abc/def/myfile1.txt
/Users/luke/test2/ghi/def/myfile2.txt
Describe what you expected to happen:
Did not expect any of the commands to surface /Users/luke/test2/ghi/def/myfile2.txt
What version of fd are you using?
Which operating system / distribution are you on?
Checks
Bug
I believe this is a bug. It's probably at least tangentially related to #851, #374, and #1577.
When multiple
--search-patharguments are supplied, fd appears to ignore (not respect) the--excludedirective when processing dirs after the first search path.Repro
I wrote a very simple bash script to repro this:
Output
Describe what you expected to happen:
Did not expect any of the commands to surface
/Users/luke/test2/ghi/def/myfile2.txtWhat version of
fdare you using?Which operating system / distribution are you on?