throwWhenNotLf method

Future<void> throwWhenNotLf({
  1. required Directory directory,
})

Throws when line endings are not set to linux and EOL conversion is OFF

Implementation

Future<void> throwWhenNotLf({required Directory directory}) async {
  // Throw if repository does not use linux line feeds internally
  final convertsLineFeeds = await get(directory: directory, ggLog: ggLog);

  if (!convertsLineFeeds) {
    throw Exception(
      [
        'Git automatic EOL conversion is OFF.',
        '  1. Create a file ".gitattributes" in the root of this repo',
        '  2. Open .gitattributes with a text editor.',
        '  3. Add the following line:',
        '      * text=auto eol=lf',
      ].join('\n'),
    );
  }
}