report method
Implementation
@override
Future<void> report(String approvedPath, String receivedPath) async {
final DiffInfo diffInfo = customDiffInfo ??
const DiffInfo(name: "Git", command: 'git', arg: 'diff --no-index');
try {
await Future.wait([
_checkFileExists(approvedPath),
_checkFileExists(receivedPath),
]);
await Process.run(
diffInfo.command,
[diffInfo.arg, approvedPath, receivedPath],
);
} catch (e, st) {
if (e is PathNotFoundException) {
ApprovalLogger.exception(e, stackTrace: st);
rethrow;
}
if (e is ProcessException) {
final ProcessResult result =
await Process.run(ApprovalUtils.commandWhere, [diffInfo.command]);
ApprovalLogger.exception(
'Error during comparison via Git. Please make sure that Git is installed and available in the system path. Error: ${e.message}. Git path: ${result.stdout}',
stackTrace: st,
);
}
rethrow;
}
}