formatGitLog function

String formatGitLog(
  1. String log
)

Implementation

String formatGitLog(String log) {
  final logs = [];
  for (var log in log.split("\n")) {
    /// 如果当前行存在以下关键字 则忽略
    if (['commit', 'Author', 'Date', 'Merge', '# Conflicts', '#    ']
        .any((e) => log.toLowerCase().startsWith(e.toLowerCase()))) {
      continue;
    }

    /// 修复重复的日志
    if (!logs.contains(log)) {
      logs.add(log);
    }
  }
  return logs.join('\n');
}