LCOV - code coverage report
Current view: top level - src/cli - git_cli.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 8 8 100.0 %
Date: 2024-03-25 10:36:11 Functions: 0 0 -

          Line data    Source code
       1             : part of 'cli.dart';
       2             : 
       3             : /// {@template unreachable_git_dependency}
       4             : /// Thrown when `flutter pub get` encounters an unreachable git dependency.
       5             : /// {@endtemplate}
       6             : class UnreachableGitDependency implements Exception {
       7             :   /// {@macro unreachable_git_dependency}
       8           1 :   const UnreachableGitDependency({required this.remote});
       9             : 
      10             :   /// The associated git remote [Uri].
      11             :   final Uri remote;
      12             : 
      13           1 :   @override
      14             :   String toString() {
      15             :     return '''
      16           1 : $remote is unreachable.
      17           1 : Make sure the remote exists and you have the correct access rights.''';
      18             :   }
      19             : }
      20             : 
      21             : /// Git CLI
      22             : class Git {
      23             :   /// Determine whether the [remote] is reachable.
      24           1 :   static Future<void> reachable(
      25             :     Uri remote, {
      26             :     required Logger logger,
      27             :   }) async {
      28             :     try {
      29           1 :       await _Cmd.run(
      30             :         'git',
      31           2 :         ['ls-remote', '$remote', '--exit-code'],
      32             :         logger: logger,
      33             :       );
      34             :     } catch (_) {
      35           1 :       throw UnreachableGitDependency(remote: remote);
      36             :     }
      37             :   }
      38             : }

Generated by: LCOV version 1.15