diff --git a/man/pkgfile.pod b/man/pkgfile.pod index d206911..ad9a8ad 100644 --- a/man/pkgfile.pod +++ b/man/pkgfile.pod @@ -49,7 +49,7 @@ Return only files which are contained within a bin or sbin directory. =item B<-d>, B<--directories> -Match directories in search results. +Additionally include directories in search results. =item B<-g>, B<--glob> diff --git a/src/pkgfile.cc b/src/pkgfile.cc index 44d2b9a..4c6e5b2 100644 --- a/src/pkgfile.cc +++ b/src/pkgfile.cc @@ -268,14 +268,11 @@ std::unique_ptr Pkgfile::BuildFilterFromOptions( std::move(filter)); } - std::unique_ptr dir_filter = - std::make_unique(); if (!options.directories) { - dir_filter = std::make_unique(std::move(dir_filter)); + filter = std::make_unique( + std::make_unique(std::make_unique()), + std::move(filter)); } - - filter = - std::make_unique(std::move(dir_filter), std::move(filter)); } return filter; diff --git a/tests/search.py b/tests/search.py index 90cd6ac..e9cda5a 100644 --- a/tests/search.py +++ b/tests/search.py @@ -75,6 +75,15 @@ def testSearchDirectories(self): testing/dhcpcd ''').lstrip('\n')) + r = self.Pkgfile(['-s', '-d', '/usr/bin/dhcpcd']) + self.assertEqual(r.returncode, 0) + + self.assertEqual( + r.stdout.decode(), + textwrap.dedent(''' + testing/dhcpcd + ''').lstrip('\n')) + def testSearchCaseInsensitive(self): r = self.Pkgfile(['-s', '-i', 'mKiNiTcPiO']) self.assertEqual(r.returncode, 0)