enableEolLf function
Add and commit sample file
Implementation
Future<void> enableEolLf(Directory testDir) async {
if (await isEolLfEnabled(testDir)) {
return;
}
final gitAttributesPath = join(testDir.path, '.gitattributes');
final file = File(gitAttributesPath);
if (!await file.exists()) {
// Create file with the required rule
await file.writeAsString('* text=auto eol=lf\n');
} else {
final sink = file.openWrite(mode: FileMode.append);
sink.writeln('* text=auto eol=lf');
await sink.close();
}
await commitFile(testDir, '.gitattributes');
}