deleteFileAndCommit function

Future<void> deleteFileAndCommit(
  1. Directory testDir,
  2. String fileName
)

Deletes and commits a file

Implementation

Future<void> deleteFileAndCommit(Directory testDir, String fileName) async {
  // Delete the file
  final file = File('${testDir.path}/$fileName');
  if (await file.exists()) {
    await file.delete();
  }

  // Stage deletion
  final result0 = await Process.run('git', [
    'rm',
    fileName,
  ], workingDirectory: testDir.path);

  _throw('Could execute »git rm $fileName«', result0);

  // Commit deletion
  await commitFile(testDir, fileName, stage: false);
}