getCurrentCommitHash static method

Future<String?> getCurrentCommitHash(
  1. String? root
)

Gets the current commit hash

Implementation

static Future<String?> getCurrentCommitHash(String? root) async {
  try {
    final result = await Process.run('git', ['rev-parse', 'HEAD'], workingDirectory: root);
    if (result.exitCode == 0) {
      return result.stdout.toString().trim();
    }
  } catch (e) {
    logger.detail('Could not get current commit hash: $e');
  }
  return null;
}