Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/src/cli/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ extension _Set on Set<String> {
if (segments.intersection(this).isNotEmpty) return true;

for (final value in this) {
if (Glob(value).matches(entity.path)) {
if (value.isNotEmpty && Glob(value).matches(entity.path)) {
return true;
}
}
Expand Down
50 changes: 50 additions & 0 deletions test/src/commands/packages_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,56 @@ void main() {
}),
);

test(
'completes normally '
'''when pubspec.yaml exists and directory is not ignored (recursive) with an empty glob''',
withRunner((commandRunner, logger, pubUpdater, printLogs) async {
final tempDirectory = Directory.systemTemp.createTempSync();
final directory = Directory(
path.join(tempDirectory.path, 'macos_plugin'),
);
final pubspecA = File(
path.join(directory.path, 'example_a', 'pubspec.yaml'),
);
final pubspecB = File(
path.join(directory.path, 'example_b', 'pubspec.yaml'),
);
pubspecA
..createSync(recursive: true)
..writeAsStringSync(
'''
name: example_a
version: 0.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
''',
);
pubspecB
..createSync(recursive: true)
..writeAsStringSync(
'''
name: example_b
version: 0.1.0

environment:
sdk: ">=2.12.0 <3.0.0"
''',
);

final result = await commandRunner.run(
['packages', 'get', '--recursive', directory.path, '--ignore=""'],
);
expect(result, equals(ExitCode.success.code));
verify(() {
logger.progress(
any(that: contains('Running "flutter packages get" in')),
);
}).called(2);
directory.deleteSync(recursive: true);
}),
);

test(
'completes normally '
'when pubspec.yaml exists and directory is ignored (recursive)',
Expand Down