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: 2023-11-15 10:29:52 Functions: 0 0 -

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

Generated by: LCOV version 1.16