commitFile function

Future<void> commitFile(
  1. Directory testDir,
  2. String name, {
  3. String message = 'Commit Message',
})

Commit the file with a name in the test directory

Implementation

Future<void> commitFile(
  Directory testDir,
  String name, {
  String message = 'Commit Message',
}) async {
  await stageFile(testDir, name);

  final result2 = await Process.run(
    'git',
    ['commit', '-m', message],
    workingDirectory: testDir.path,
  );
  if (result2.exitCode != 0) {
    throw Exception('Could not commit $name.');
  }
}