isGitRepository method

Future<bool> isGitRepository()

Implementation

Future<bool> isGitRepository() async {
  final result =
      await Process.run('git', ['rev-parse', '--is-inside-work-tree']);

  if (result.exitCode != 0) {
    logger
      ..err('Not a git repository')
      ..detail('Error: ${result.stderr}');
    return false;
  }

  return true;
}