hasAtLeastOneCommit method

Future<bool> hasAtLeastOneCommit()

Implementation

Future<bool> hasAtLeastOneCommit() async {
  final result = await Process.run('git', ['rev-list', '--count', 'HEAD']);

  if (result.exitCode != 0) {
    logger
      ..err('Failed to get commit count')
      ..detail('Error: ${result.stderr}');
    return false;
  }

  final count = int.tryParse(result.stdout as String);

  return count != null && count > 0;
}