getCreated static method

DateTime? getCreated(
  1. File file
)

Get date when file was first tracked in git history.

Implementation

static DateTime? getCreated(File file) {
  if (!isGitInstalled() || !isGitDir()) {
    return null;
  }

  try {
    final result =
        'git log --diff-filter=A --follow --format=%aI -1 -- ${file.path}'
            .firstLine;

    if (result == null) {
      return null;
    }

    return _parseOutput(result);
  } catch (e) {
    return null;
  }

}