Don't ignore 'packages/' over the root-dir (#3162)

diff --git a/lib/src/package.dart b/lib/src/package.dart
index 6a3b0ff..5c46709 100644
--- a/lib/src/package.dart
+++ b/lib/src/package.dart
@@ -279,7 +279,7 @@
             : (fileExists(gitIgnore) ? gitIgnore : null);
 
         final rules = [
-          if (dir == '.') ..._basicIgnoreRules,
+          if (dir == beneath) ..._basicIgnoreRules,
           if (ignoreFile != null) readTextFile(ignoreFile),
         ];
         return rules.isEmpty
diff --git a/test/package_list_files_test.dart b/test/package_list_files_test.dart
index 7891270..921175d 100644
--- a/test/package_list_files_test.dart
+++ b/test/package_list_files_test.dart
@@ -254,6 +254,23 @@
       });
     });
 
+    test("Don't ignore packages/ before the package root", () async {
+      await d.dir(appPath, [
+        d.dir('packages', [
+          d.dir('app', [
+            d.appPubspec(),
+            d.dir('packages', [d.file('a.txt')]),
+          ]),
+        ]),
+      ]).create();
+
+      createEntrypoint(p.join(appPath, 'packages', 'app'));
+
+      expect(entrypoint.root.listFiles(), {
+        p.join(root, 'pubspec.yaml'),
+      });
+    });
+
     group('with a submodule', () {
       setUp(() async {
         await d.git('submodule', [